github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/tests/assert.c (about)

     1  // This file contains tests for assert.h.
     2  //
     3  // Note: assert() failures print directly. The output of this program will not
     4  // be valid TAP.
     5  
     6  #include "tests.h"
     7  #include <assert.h>
     8  #include <stdio.h>
     9  
    10  void print_number(int* myInt)
    11  {
    12      assert(myInt != NULL);
    13      printf("%d\n", *myInt);
    14  }
    15  
    16  int main()
    17  {
    18      plan(0);
    19  
    20      int a = 10;
    21      int* b = NULL;
    22      int* c = NULL;
    23  
    24      b = &a;
    25  
    26      print_number(b);
    27      print_number(c);
    28  
    29      fail("%s", "It shouldn't make it to here!");
    30      done_testing();
    31  }
    32  
    33  void os() {}