Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

69 řádky
1.5 KiB

  1. /*
  2. * simple simple testsuite program
  3. * Copyright (c) 2007 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #include "config.h"
  15. #include "common.h"
  16. #if !defined(__KERNEL__)
  17. # if defined(HAVE_INTTYPES_H)
  18. # include <inttypes.h>
  19. # endif
  20. # include <stdio.h>
  21. # include <stdlib.h>
  22. #endif
  23. #include "cucul.h"
  24. #define TEST(x) \
  25. do \
  26. { \
  27. tests++; \
  28. if((x)) \
  29. passed++; \
  30. else \
  31. fprintf(stderr, "test #%i failed\n", (tests)); \
  32. } \
  33. while(0)
  34. int main(int argc, char *argv[])
  35. {
  36. cucul_canvas_t *cv;
  37. int tests = 0, passed = 0;
  38. cv = cucul_create_canvas(0, 0);
  39. cucul_put_char(cv, 0, 0, 'x');
  40. TEST(cucul_get_char(cv, 0, 0) != 'x');
  41. cucul_set_canvas_size(cv, 1, 1);
  42. TEST(cucul_get_char(cv, 0, 0) != 'x');
  43. TEST(cucul_get_char(cv, 0, 0) == ' ');
  44. cucul_put_char(cv, 0, 0, 'y');
  45. TEST(cucul_get_char(cv, 0, 0) == 'y');
  46. cucul_set_canvas_size(cv, 1000, 1000);
  47. TEST(cucul_get_canvas_width(cv) == 1000);
  48. cucul_put_char(cv, 999, 999, 'z');
  49. TEST(cucul_get_char(cv, 999, 999) == 'z');
  50. cucul_free_canvas(cv);
  51. fprintf(stderr, "%i tests, %i errors\n", tests, tests - passed);
  52. return 0;
  53. }