test_flags.c 502 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * This is a test for flags in $package$
  3. */
  4. #include <stdlib.h>
  5. #include "si_test.h"
  6. #include "flags.h"
  7. TEST_FUNC(flags) {
  8. int flags = 0;
  9. TEST_INTEQ( 1, flags_set(&flags, 1));
  10. TEST_TRUE(flags_get(flags, 1));
  11. TEST_FALSE(flags_get(flags, 2));
  12. TEST_INTEQ( 3, flags_put(&flags, 2, 1));
  13. TEST_TRUE(flags_get(flags, 2));
  14. TEST_INTEQ( 1, flags_put(&flags, 2, 0));
  15. TEST_FALSE(flags_get(flags, 2));
  16. TEST_DONE();
  17. }
  18. int main(void) {
  19. TEST_INIT();
  20. TEST_RUN(flags);
  21. TEST_REPORT();
  22. }