Skip to content

Instantly share code, notes, and snippets.

@dpsanders
Created February 26, 2018 20:41
Show Gist options
  • Save dpsanders/200c10be8ede3259d37cd5000d15d014 to your computer and use it in GitHub Desktop.
Save dpsanders/200c10be8ede3259d37cd5000d15d014 to your computer and use it in GitHub Desktop.
test_package = ""
if VERSION <= v"0.6"
using Base.Test
test_package = "Base.Test"
else
using Test
test_package = "Test"
end
function create_test_file(N)
output = open("tests.jl", "w")
println(output,
"""
using $test_package
@testset "Tests" begin
"""
)
for i in 1:N
println(output, "@test $i == $i")
end
println(output, "end")
close(output)
end
function runtests(N)
Ns = 25:25:N
times = Float64[]
for N in Ns
create_test_file(N)
t = @elapsed include("tests.jl")
push!(times, t)
end
return Ns, times
end
N = 300
if length(ARGS) > 0
try
N = parse(Int, ARGS[1])
catch e
N = 300
end
end
println("Using N = $N")
Ns, times = runtests(N)
if VERSION >= v"0.7-DEV"
using DelimitedFiles
end
writedlm("test_times_$VERSION.dat", [Ns times])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment