testc_log.c 631 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "faux/log.h"
  5. #include "faux/str.h"
  6. int testc_faux_log_facility_id(void)
  7. {
  8. const char *str = "daemon";
  9. int e = LOG_DAEMON;
  10. int r = 0;
  11. if (!faux_log_facility_id(str, &r)) {
  12. printf("Can't get id by string\n");
  13. return -1;
  14. }
  15. if (r != e) {
  16. printf("Etalon: %d, Result: %d\n", e, r);
  17. return -1;
  18. }
  19. return 0;
  20. }
  21. int testc_faux_log_facility_str(void)
  22. {
  23. int id = LOG_KERN;
  24. const char *e = "kern";
  25. const char *r = NULL;
  26. r = faux_log_facility_str(id);
  27. if (strcmp(r, e) != 0) {
  28. printf("Etalon: %s, Result: %s\n", e, r);
  29. return -1;
  30. }
  31. return 0;
  32. }