summaryrefslogtreecommitdiff
path: root/debian/tests/utils.sh
blob: 6798f820265d8aac8e29a952977d24954ef6e67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

files="single_triangle"
reprs="vector_vector vector_heap vector_set vector_list full_pivot_column sparse_pivot_column heap_pivot_column bit_tree_pivot_column"
algos="standard twist chunk chunk_sequential spectral_sequence row"

oneTimeSetUp() {
    set -u
}

parse() {
    tail -n +2 $1 | sort
}

test() {
    for file in $files
    do
        for repr in $reprs
        do
            for algo in $algos
            do
                tmpfile=$(mktemp -p $AUTOPKGTEST_TMP)
                ( set -x; /usr/bin/phat --ascii --${repr} --${algo} examples/${file}.dat ${tmpfile} )
                assertEquals "Non-zero return code." 0 $?
                [ "$(parse debian/tests/reference/${file}.txt)" == "$(parse $tmpfile)" ]
                assertEquals "Wrong result." 0 $?
            done
        done
    done
}

. shunit2