aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/box2d/Benchmark.cpp11
-rw-r--r--tests/bullet/Demos/Benchmarks/main.cpp11
-rw-r--r--tests/life.c13
-rwxr-xr-xtests/runner.py68
-rw-r--r--tests/skinning_test_no_simd.cpp11
-rw-r--r--tests/zlib/benchmark.c11
6 files changed, 69 insertions, 56 deletions
diff --git a/tests/box2d/Benchmark.cpp b/tests/box2d/Benchmark.cpp
index b8ebdf1c..56682674 100644
--- a/tests/box2d/Benchmark.cpp
+++ b/tests/box2d/Benchmark.cpp
@@ -53,12 +53,13 @@ result_t measure(clock_t times[FRAMES]) {
}
int main(int argc, char **argv) {
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: WARMUP = 32; FRAMES = 161; break;
- case 1: WARMUP = 64; FRAMES = 333; break;
- case 2: WARMUP = 5*64; FRAMES = 7*333; break;
- case 3: WARMUP = 10*64; FRAMES = 17*333; break;
+ case 0: return 0; break;
+ case 1: WARMUP = 32; FRAMES = 161; break;
+ case 2: WARMUP = 64; FRAMES = 333; break;
+ case 3: WARMUP = 5*64; FRAMES = 7*333; break;
+ case 4: WARMUP = 10*64; FRAMES = 17*333; break;
default: printf("error: %d\\n", arg); return -1;
}
diff --git a/tests/bullet/Demos/Benchmarks/main.cpp b/tests/bullet/Demos/Benchmarks/main.cpp
index 1d7b6a2a..b050308a 100644
--- a/tests/bullet/Demos/Benchmarks/main.cpp
+++ b/tests/bullet/Demos/Benchmarks/main.cpp
@@ -32,12 +32,13 @@ extern bool gDisableDeactivation;
int main(int argc, char **argv) {
int NUM_TESTS;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: NUM_TESTS = 7; break;
- case 1: NUM_TESTS = 33; break;
- case 2: NUM_TESTS = 5*33; break;
- case 3: NUM_TESTS = 7*35; break;
+ case 0: return 0; break;
+ case 1: NUM_TESTS = 7; break;
+ case 2: NUM_TESTS = 33; break;
+ case 3: NUM_TESTS = 5*33; break;
+ case 4: NUM_TESTS = 7*35; break;
default: printf("error: %d\\n", arg); return -1;
}
diff --git a/tests/life.c b/tests/life.c
index 5f902cf1..74f0c108 100644
--- a/tests/life.c
+++ b/tests/life.c
@@ -77,16 +77,19 @@ void game(int w, int h, int i)
int main(int argc, char **argv)
{
int w, h, i;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: w = h = 32; i = 13000; break;
- case 1: w = h = 32; i = 24000; break;
- case 2: w = h = 32; i = 5*24000; break;
- case 3: w = h = 32; i = 10*24000; break;
+ case 0: return 0; break;
+ case 1: w = h = 32; i = 13000; break;
+ case 2: w = h = 32; i = 24000; break;
+ case 3: w = h = 32; i = 5*24000; break;
+ case 4: w = h = 32; i = 10*24000; break;
default: printf("error: %d\\n", arg); return -1;
}
printf("life: %d,%d,%d,%d\n", arg, w, h, i);
game(w, h, i);
+
+ return 0;
}
diff --git a/tests/runner.py b/tests/runner.py
index a92f4bc4..b7a7478f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3410,7 +3410,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1
[]
[][][] []
--------------------------------
-''', ['0'], force_c=True)
+''', ['1'], force_c=True)
def test_array2(self):
src = '''
@@ -12404,12 +12404,13 @@ elif 'benchmark' in str(sys.argv):
#include<stdio.h>
#include<math.h>
int main(int argc, char **argv) {
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: arg = 130000; break;
- case 1: arg = 220000; break;
- case 2: arg = 610000; break;
- case 3: arg = 1010000; break;
+ case 0: return 0; break;
+ case 1: arg = 130000; break;
+ case 2: arg = 220000; break;
+ case 3: arg = 610000; break;
+ case 4: arg = 1010000; break;
default: printf("error: %d\\n", arg); return -1;
}
@@ -12440,12 +12441,13 @@ elif 'benchmark' in str(sys.argv):
#include<stdlib.h>
int main(int argc, char **argv) {
int N, M;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: N = 1024*1024; M = 400; break;
- case 1: N = 1024*1024; M = 800; break;
- case 2: N = 1024*1024; M = 4000; break;
- case 3: N = 1024*1024; M = 8000; break;
+ case 0: return 0; break;
+ case 1: N = 1024*1024; M = 400; break;
+ case 2: N = 1024*1024; M = 800; break;
+ case 3: N = 1024*1024; M = 4000; break;
+ case 4: N = 1024*1024; M = 8000; break;
default: printf("error: %d\\n", arg); return -1;
}
@@ -12528,12 +12530,13 @@ elif 'benchmark' in str(sys.argv):
int sum() { return x + y + z + r + g + b; }
};
int main(int argc, char **argv) {
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: arg = 625; break;
- case 1: arg = 1250; break;
- case 2: arg = 5*1250; break;
- case 3: arg = 10*1250; break;
+ case 0: return 0; break;
+ case 1: arg = 625; break;
+ case 2: arg = 1250; break;
+ case 3: arg = 5*1250; break;
+ case 4: arg = 10*1250; break;
default: printf("error: %d\\n", arg); return -1;
}
@@ -12564,18 +12567,19 @@ elif 'benchmark' in str(sys.argv):
'int n = argc > 1 ? atoi(argv[1]) : 0;',
'''
int n;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: n = 10; break;
- case 1: n = 11; break;
+ case 0: return 0; break;
+ case 1: n = 10; break;
case 2: n = 11; break;
- case 3: n = 12; break;
+ case 3: n = 11; break;
+ case 4: n = 12; break;
default: printf("error: %d\\n", arg); return -1;
}
'''
)
assert 'switch(arg)' in src
- self.do_benchmark('fannkuch', src, ['11'], 'Pfannkuchen(11) = 51.')
+ self.do_benchmark('fannkuch', src, [], 'Pfannkuchen(11) = 51.')
def test_corrections(self):
src = r'''
@@ -12583,12 +12587,13 @@ elif 'benchmark' in str(sys.argv):
#include<math.h>
int main(int argc, char **argv) {
int N, M;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: N = 20000; M = 3500; break;
- case 1: N = 20000; M = 7000; break;
- case 2: N = 20000; M = 5*7000; break;
- case 3: N = 20000; M = 10*7000; break;
+ case 0: return 0; break;
+ case 1: N = 20000; M = 3500; break;
+ case 2: N = 20000; M = 7000; break;
+ case 3: N = 20000; M = 5*7000; break;
+ case 4: N = 20000; M = 10*7000; break;
default: printf("error: %d\\n", arg); return -1;
}
@@ -12612,12 +12617,13 @@ elif 'benchmark' in str(sys.argv):
src = open(path_from_root('tests', 'fasta.cpp'), 'r').read().replace('double', double_rep)
src = src.replace(' const size_t n = ( argc > 1 ) ? atoi( argv[1] ) : 512;', '''
int n;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: n = 19000000/2; break;
- case 1: n = 19000000; break;
- case 2: n = 19000000*5; break;
- case 3: n = 19000000*10; break;
+ case 0: return 0; break;
+ case 1: n = 19000000/2; break;
+ case 2: n = 19000000; break;
+ case 3: n = 19000000*5; break;
+ case 4: n = 19000000*10; break;
default: printf("error: %d\\n", arg); return -1;
}
''')
diff --git a/tests/skinning_test_no_simd.cpp b/tests/skinning_test_no_simd.cpp
index 34a82d6d..9c99f093 100644
--- a/tests/skinning_test_no_simd.cpp
+++ b/tests/skinning_test_no_simd.cpp
@@ -172,12 +172,13 @@ void calculateVerticesAndNormals_x87(
int main (int argc, char*argv[])
{
int N, M;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: N = 6600; M = 6500; break;
- case 1: N = 9500; M = 10000; break;
- case 2: N = 2*11000; M = 2*12000; break;
- case 3: N = 3*10000; M = 3*10800; break;
+ case 0: return 0; break;
+ case 1: N = 6600; M = 6500; break;
+ case 2: N = 9500; M = 10000; break;
+ case 3: N = 2*11000; M = 2*12000; break;
+ case 4: N = 3*10000; M = 3*10800; break;
default: printf("error: %d\\n", arg); return -1;
}
diff --git a/tests/zlib/benchmark.c b/tests/zlib/benchmark.c
index db1ca7d4..5fe4a903 100644
--- a/tests/zlib/benchmark.c
+++ b/tests/zlib/benchmark.c
@@ -27,12 +27,13 @@ void __attribute__ ((noinline)) doit(char *buffer, int size, int i) {
int main(int argc, char **argv) {
int size, iters;
- int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ int arg = argc > 1 ? argv[1][0] - '0' : 2;
switch(arg) {
- case 0: size = 100000; iters = 250; break;
- case 1: size = 100000; iters = 500; break;
- case 2: size = 100000; iters = 5*500; break;
- case 3: size = 100000; iters = 10*500; break;
+ case 0: return 0; break;
+ case 1: size = 100000; iters = 250; break;
+ case 2: size = 100000; iters = 500; break;
+ case 3: size = 100000; iters = 5*500; break;
+ case 4: size = 100000; iters = 10*500; break;
default: printf("error: %d\\n", arg); return -1;
}