assert.h

Single-file assertion library for C
git clone git://git.finwo.net/lib/assert.h
Log | Files | Refs | README

functions.test.c (385B)


      1 #include "test.h"
      2 #include "./functions.c"
      3 
      4 void test_add() {
      5   ASSERT("2 + 2 = 4", add(2, 2) == 4);
      6   ASSERT_EQUALS(add(3, 3), 6);
      7 }
      8 
      9 void test_mult() {
     10   ASSERT("2 * 2 = 4", mult(2, 2) == 4);
     11   ASSERT_EQUALS(mult(3, 3), 9);
     12 }
     13 
     14 void test_str() {
     15   ASSERT_STRING_EQUALS("calzone", pizza());
     16 }
     17 
     18 int main() {
     19   RUN(test_add);
     20   RUN(test_mult);
     21   RUN(test_str);
     22   return TEST_REPORT();
     23 }