public_func.c 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (c) 2015 the Civetweb developers
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. #ifdef _MSC_VER
  22. #define _CRT_SECURE_NO_WARNINGS
  23. #endif
  24. #include <stdlib.h>
  25. #include <stdio.h>
  26. #include "public_func.h"
  27. #include <civetweb.h>
  28. /* This unit test file uses the excellent Check unit testing library.
  29. * The API documentation is available here:
  30. * http://check.sourceforge.net/doc/check_html/index.html
  31. */
  32. Suite *make_public_func_suite(void)
  33. {
  34. Suite *const suite = suite_create("PublicFunc");
  35. TCase *const version = tcase_create("Version");
  36. TCase *const get_valid_options = tcase_create("Options");
  37. TCase *const get_builtin_mime_type = tcase_create("MIME types");
  38. TCase *const tstrncasecmp = tcase_create("strcasecmp");
  39. TCase *const urlencodingdecoding = tcase_create("URL encoding decoding");
  40. TCase *const cookies = tcase_create("Cookies and variables");
  41. TCase *const md5 = tcase_create("MD5");
  42. tcase_add_test(version, test_mg_version);
  43. suite_add_tcase(suite, version);
  44. tcase_add_test(get_valid_options, test_mg_get_valid_options);
  45. suite_add_tcase(suite, get_valid_options);
  46. tcase_add_test(get_builtin_mime_type, test_mg_get_builtin_mime_type);
  47. suite_add_tcase(suite, get_builtin_mime_type);
  48. tcase_add_test(tstrncasecmp, test_mg_strncasecmp);
  49. suite_add_tcase(suite, tstrncasecmp);
  50. tcase_add_test(urlencodingdecoding, test_mg_url_encode);
  51. tcase_add_test(urlencodingdecoding, test_mg_url_decode);
  52. suite_add_tcase(suite, urlencodingdecoding);
  53. tcase_add_test(cookies, test_mg_get_cookie);
  54. tcase_add_test(cookies, test_mg_get_var);
  55. suite_add_tcase(suite, cookies);
  56. tcase_add_test(md5, test_mg_md5);
  57. suite_add_tcase(suite, md5);
  58. return suite;
  59. }