1
0

string.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "lub/test.h"
  2. #include "lub/string.h"
  3. /*************************************************************
  4. * TEST CODE
  5. ************************************************************* */
  6. static int testseq;
  7. /*--------------------------------------------------------------- */
  8. /* This is the main entry point for this executable
  9. */
  10. int main(int argc, const char *argv[])
  11. {
  12. int comp;
  13. int status;
  14. lub_test_parse_command_line(argc,argv);
  15. lub_test_begin("lub_string");
  16. lub_test_seq_begin(++testseq,"lub_string_nocasecmp()");
  17. comp = lub_string_nocasecmp("HeLlO","hello");
  18. lub_test_check((0 == comp),
  19. "Check 'HeLlO' == 'hello'");
  20. comp = lub_string_nocasecmp("HeLlO","hell");
  21. lub_test_check((comp > 0),
  22. "Check 'HeLlO' > 'hell'");
  23. comp = lub_string_nocasecmp("hell","HeLlO");
  24. lub_test_check((comp < 0),
  25. "Check 'hell' < 'HeLlO'");
  26. comp = lub_string_nocasecmp("HeLlO","hellp");
  27. lub_test_check((comp < 0),
  28. "Check 'HeLlO' < 'hellp'");
  29. comp = lub_string_nocasecmp("hellp","HeLlO");
  30. lub_test_check((comp > 0),
  31. "Check 'hellp' > 'HeLlO'");
  32. lub_test_seq_end();
  33. /* tidy up */
  34. status = lub_test_get_status();
  35. lub_test_end();
  36. return status;
  37. }