akaros/user/utest/example.c
<<
>>
Prefs
   1#include <utest/utest.h>
   2
   3TEST_SUITE("EXAMPLE");
   4
   5/* <--- Begin definition of test cases ---> */
   6
   7bool test_one(void) {
   8        UT_ASSERT_M("One plus one should equal 2", 1+1 == 2);
   9        return TRUE;
  10}
  11
  12bool test_two(void) {
  13        UT_ASSERT_M("One minus one should equal 0", 1-1 == 0);
  14        return TRUE;
  15}
  16
  17bool test_three(void) {
  18        UT_ASSERT_M("1 should equal 1", 1 == 1);
  19        return TRUE;
  20}
  21
  22/* <--- End definition of test cases ---> */
  23
  24struct utest utests[] = {
  25        UTEST_REG(one),
  26        UTEST_REG(two),
  27        UTEST_REG(three) 
  28};
  29int num_utests = sizeof(utests) / sizeof(struct utest);
  30
  31int main(int argc, char *argv[]) {
  32        char **whitelist = &argv[1];
  33        int whitelist_len = argc - 1;
  34
  35        RUN_TEST_SUITE(utests, num_utests, whitelist, whitelist_len);
  36}
  37
  38