mirror of
https://github.com/MariaDB/server.git
synced 2025-05-31 08:42:45 +03:00
An implementation of the TAP framework for writing unit tests. Makefile.am: Adding directories mytap and unittest configure.in: Building Makefiles for mytap and unittest directories. mytap/Doxyfile: New BitKeeper file ``mytap/Doxyfile'' mytap/Makefile.am: New BitKeeper file ``mytap/Makefile.am'' mytap/t/basic.t.c: New BitKeeper file ``mytap/t/basic.t.c'' mytap/tap.c: New BitKeeper file ``mytap/tap.c'' mytap/tap.h: New BitKeeper file ``mytap/tap.h'' unittest/Makefile.am: New BitKeeper file ``unittest/Makefile.am'' unittest/examples/Makefile.am: New BitKeeper file ``unittest/examples/Makefile.am'' unittest/examples/no_plan.t.c: New BitKeeper file ``unittest/examples/no_plan.t.c'' unittest/examples/simple.t.c: New BitKeeper file ``unittest/examples/simple.t.c'' unittest/examples/skip.t.c: New BitKeeper file ``unittest/examples/skip.t.c'' unittest/examples/skip_all.t.c: New BitKeeper file ``unittest/examples/skip_all.t.c'' unittest/examples/todo.t.c: New BitKeeper file ``unittest/examples/todo.t.c'' unittest/mysys/Makefile.am: New BitKeeper file ``unittest/mysys/Makefile.am'' unittest/mysys/bitmap.t.c: New BitKeeper file ``unittest/mysys/bitmap.t.c'' unittest/unit.pl: New BitKeeper file ``unittest/unit.pl''
39 lines
624 B
C
39 lines
624 B
C
|
|
#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();
|
|
}
|
|
|