diff options
author | serg@serg.mylan <> | 2006-06-01 12:25:47 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2006-06-01 12:25:47 +0200 |
commit | 5409997d49a8c228f1a6a2c029572fcf1f221caf (patch) | |
tree | 445a123eb59c53a13ae718cbc126d350bc89610f /unittest/examples/simple-t.c | |
parent | 2b9b84460aa3e2b0dce089a4067052a16dab7278 (diff) | |
download | mariadb-git-5409997d49a8c228f1a6a2c029572fcf1f221caf.tar.gz |
unittest:
rename *.t* to *-t* to be automake-friendly
simplify Makefiles
test_atomic.c:
move to unittest, add GPL comment, fix warnings, convert to tap framework.
configure:
remove custom tests for available types, use AC_CHECK_TYPE instead
x86-gcc.h:
fix gcc -ansi errors while maintaining readability
ignore:
added *-t
Diffstat (limited to 'unittest/examples/simple-t.c')
-rw-r--r-- | unittest/examples/simple-t.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/unittest/examples/simple-t.c b/unittest/examples/simple-t.c new file mode 100644 index 00000000000..866af865327 --- /dev/null +++ b/unittest/examples/simple-t.c @@ -0,0 +1,38 @@ + +#include <tap.h> + +unsigned int gcs(unsigned int a, unsigned int b) +{ + if (b > a) { + unsigned int t = a; + a = b; + b = t; + } + + while (b != 0) { + unsigned int m = a % b; + a = b; + b = m; + } + return a; +} + +int main() { + unsigned int a,b; + unsigned int failed; + plan(1); + diag("Testing basic functions"); + failed = 0; + for (a = 1 ; a < 2000 ; ++a) + for (b = 1 ; b < 2000 ; ++b) + { + unsigned int d = gcs(a, b); + if (a % d != 0 || b % d != 0) { + ++failed; + diag("Failed for gcs(%4u,%4u)", a, b); + } + } + ok(failed == 0, "Testing gcs()"); + return exit_status(); +} + |