On 2008-02-12, M. Edward (Ed) Borasky <znmeb / cesmail.net> wrote: > This may seem like a silly question, but how do C programmers (assume > gcc/linux for now) do behavior-driven/test-driven development? Aside > from the obvious cheat (using RSpec to compile, link and execute the C > code) are there tools in C to do this? > http://chneukirchen.org/repos/taptap/include/taptap.h #include "taptap.h" int main() { plan (11); ok(1 == 1); ok(1 == 1, "one equals one"); ok(1 == 2); ok(1 == 2, "one equals two"); is(1, 1); is(1, 1, "one equals one"); is(1, 2); is(1, 2, "one equals two"); fail("foo"); pass("yay"); pass("yum"); fail(); pass(); bail_out ("g'dammnit."); fail("you should not see this"); return taptap_summary(); } $ taptap test-taptap test-taptap..... 3/11 FAILED: test/test-taptap.c:11: 1 == 2 failed test-taptap..... 4/11 FAILED: test/test-taptap.c:12: 1 == 2 failed - one equals two test-taptap..... 7/11 FAILED: test/test-taptap.c:17: 1(1, 0x1) != 2 test-taptap..... 8/11 FAILED: test/test-taptap.c:18: 1(1, 0x1) != 2 - one equals two test-taptap..... 9/11 FAILED: test/test-taptap.c:20 - foo test-taptap..... 12/11 FAILED: test/test-taptap.c:24 BAIL OUT: g'dammnit.3/11 PASS: test-taptap: Tests took 0.03 seconds. FAILED tests 3, 4, 7, 8, 9, 12 3) test/test-taptap.c:11: 1 == 2 failed 4) test/test-taptap.c:12: 1 == 2 failed - one equals two 7) test/test-taptap.c:17: 1(1, 0x1) != 2 8) test/test-taptap.c:18: 1(1, 0x1) != 2 - one equals two 9) test/test-taptap.c:20 - foo 12) test/test-taptap.c:24 Failed 6/13 tests, 53.85% okay. WEIRD: Planned 11 tests, but ran 13. BAILED OUT: g'dammnit. -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org