miniroon

Simplistic macaroon-based authorization for Unix systems
git clone https://ccx.te2000.cz/git/miniroon
Log | Files | Refs | README

cmd_test.c (824B)


      1 #include <stdlib.h>  /* getenv */
      2 #include <unistd.h>  /* chdir */
      3 
      4 #include <skalibs/strerr.h>
      5 
      6 #include "tests.h"
      7 
      8 /* Declare a local suite. */
      9 SUITE(selftest);
     10 
     11 TEST expect_equal(void) {
     12     int i = 10;
     13     ASSERT_EQ(10, i);
     14     PASS();
     15 }
     16 
     17 /* Primary test suite. */
     18 SUITE(selftest) {
     19     RUN_TEST(expect_equal);
     20 }
     21 
     22 /* Add definitions that need to be in the test runner's main file. */
     23 GREATEST_MAIN_DEFS();
     24 
     25 int main(int argc, char **argv) {
     26     char *test_dir = getenv("TEST_DIR");
     27     if(test_dir != NULL) {
     28         if(chdir(test_dir) != 0) {
     29             strerr_dief3sys(111, "could not chdir to: '", test_dir, "'");
     30         }
     31     }
     32     GREATEST_MAIN_BEGIN();      /* command-line arguments, initialization. */
     33 
     34     RUN_SUITE(selftest);
     35     RUN_SUITE(blackbox);
     36 
     37     GREATEST_MAIN_END();        /* display results */
     38 }