experimental benchmar support
[libc-test] / src / foo / foo.c
1 #include "test.h"
2
3 // dummy test
4
5 static unsigned foo(unsigned n) {
6         int i;
7
8         for (i = 0; i < 10; i++) {
9                 n = n*n;
10                 n = n+123;
11                 n = n/7;
12         }
13         return n;
14 }
15
16 void bench_foo() {
17         int i;
18
19         for (i = 0; i < N; i++)
20                 foo(3);
21 }
22
23 void test_foo() {
24         unsigned n = foo(3);
25
26         if (n != 123)
27                 error("foo(3):%u expected 123\n", n);
28 }