utils_test.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version 2
  5. * of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. * Author: g0tsu
  12. * Email: g0tsu at dnmx.0rg
  13. */
  14. #include <stdio.h>
  15. #include <assert.h>
  16. #include <libcaptcha.h>
  17. #include <global.h>
  18. static int test_hex_to_rgb() {
  19. lc_rgb *rgb = lc_rgb_from_text("#ffbb0f00");
  20. if (rgb->r != 0xff || rgb->g != 0xbb || rgb->b != 0x0f) {
  21. lc_free(rgb);
  22. return 1;
  23. }
  24. lc_free(rgb);
  25. rgb = lc_rgb_from_text("#ffbb0f");
  26. if (rgb->r != 0xff || rgb->g != 0xbb || rgb->b != 0x0f) {
  27. lc_free(rgb);
  28. return 1;
  29. }
  30. lc_free(rgb);
  31. rgb = lc_rgb_from_text("ffbb0f");
  32. if (rgb)
  33. return 1;
  34. return 0;
  35. }
  36. int main() {
  37. assert(!test_hex_to_rgb());
  38. return 0;
  39. }