aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-04 13:52:23 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-04 13:52:23 -0800
commit6b7bf0aa4ed04bbd30d9f69a12bb7a45e7f0c7a4 (patch)
treebe26fd25e2b5f94f83961512181840321457904a /tests/runner.py
parent1f70fe65a943f3867c12895986bfbc63190981de (diff)
qsort
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 59e44102..42920946 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -901,15 +901,29 @@ if 'benchmark' not in sys.argv:
printf("*cleaned*\\n");
}
+ int comparer(const void *a, const void *b) {
+ int aa = *((int*)a);
+ int bb = *((int*)b);
+ return aa - bb;
+ }
+
int main() {
+ // timeofday
timeval t;
gettimeofday(&t, NULL);
- printf("*%d,%d\\n", int(t.tv_sec), int(t.tv_usec));
+ printf("*%d,%d\\n", int(t.tv_sec), int(t.tv_usec)); // should not crash
+
+ // atexit
atexit(clean);
+
+ // qsort
+ int values[6] = { 3, 2, 5, 1, 5, 6 };
+ qsort(values, 5, sizeof(int), comparer);
+ printf("*%d,%d,%d,%d,%d,%d*\\n", values[0], values[1], values[2], values[3], values[4], values[5]);
return 0;
}
'''
- self.do_test(src, '*cleaned*')
+ self.do_test(src, '*1,2,3,5,5,6*\n*cleaned*')
def test_statics(self):
src = '''