~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to test/runtests.jl

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-02-06 17:54:29 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130206175429-13br5kqpkfjqdmre
Tags: 0.0.0+20130206.git32ff5759-1
* New upstream snapshot.
* debian/copyright: reflect upstream changes
* debian/rules: update get-orig-source to reflect upstream changes
   + Don't ship nginx
   + Adapt for new configure-random target in deps/Makefile
* Enable build of Tk wrapper.
   + debian/control: add build dependency on tk-dev
   + debian/rules: add tk rule to build-arch
* debian/julia.install: install VERSION and COMMIT files
* no-webrepl.patch: new patch
* Refresh other patches
* Add source override for config.status file under deps/random/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require("test")
2
1
using Test
3
2
 
4
3
function runtests(name)
5
4
    println("     \033[1m*\033[0m \033[31m$(name)\033[0m")
6
 
    flush(OUTPUT_STREAM)
 
5
    #flush(OUTPUT_STREAM)
7
6
    include("$name.jl")
8
7
end
9
8
 
10
9
function check_approx_eq(va, vb, Eps, astr, bstr)
11
10
    diff = max(abs(va - vb))
12
 
    sdiff = strcat("|", astr, " - ", bstr, "| < ", Eps)
 
11
    sdiff = string("|", astr, " - ", bstr, "| < ", Eps)
13
12
    if diff < Eps
14
13
        nothing
15
14
    else
21
20
check_approx_eq(va, vb, astr, bstr) = check_approx_eq(va, vb, 10^4*length(va)*eps(max(max(abs(va)), max(abs(vb)))) * max(1, max(abs(va)), max(abs(vb))), astr, bstr)
22
21
 
23
22
macro assert_approx_eq_eps(a, b, c)
24
 
    quote
25
 
        check_approx_eq($(esc(a)), $(esc(b)), $(esc(c)), $(string(a)), $(string(b)))
26
 
    end
 
23
    :(check_approx_eq($(esc(a)), $(esc(b)), $(esc(c)), $(string(a)), $(string(b))))
27
24
end
28
25
 
29
26
macro assert_approx_eq(a, b)
30
 
    quote
31
 
        check_approx_eq($(esc(a)), $(esc(b)), $(string(a)), $(string(b)))
32
 
    end
 
27
    :(check_approx_eq($(esc(a)), $(esc(b)), $(string(a)), $(string(b))))
33
28
end
34
29
 
35
30
macro timeit(ex,name)
36
31
    quote
37
32
        t = Inf
38
 
        for i=1:5
 
33
        for i = 1:5
39
34
            t = min(t, @elapsed $(esc(ex)))
40
35
        end
41
 
        println(rpad(strcat($name,":"), 20), t)
 
36
        println(rpad(string($name,":"), 20), t)
42
37
    end
43
38
end
44
39
 
 
40
shift!(LOAD_PATH) # looking in . messes things up badly
 
41
 
45
42
for t in ARGS
46
43
    runtests(t)
47
 
    println("    \033[32;1mSUCCESS\033[0m")
48
44
end
 
45
println("    \033[32;1mSUCCESS\033[0m")