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ů.
 
 
 
 
 
 

66 řá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. #if !defined(__KERNEL__)
  16. # include <stdio.h>
  17. # include <stdlib.h>
  18. #endif
  19. #include "caca.h"
  20. #define TEST(x) \
  21. do \
  22. { \
  23. tests++; \
  24. if((x)) \
  25. passed++; \
  26. else \
  27. fprintf(stderr, "test #%i failed\n", (tests)); \
  28. } \
  29. while(0)
  30. int main(int argc, char *argv[])
  31. {
  32. caca_canvas_t *cv;
  33. int tests = 0, passed = 0;
  34. cv = caca_create_canvas(0, 0);
  35. caca_put_char(cv, 0, 0, 'x');
  36. TEST(caca_get_char(cv, 0, 0) != 'x');
  37. caca_rotate_180(cv);
  38. caca_set_canvas_size(cv, 1, 1);
  39. TEST(caca_get_char(cv, 0, 0) != 'x');
  40. TEST(caca_get_char(cv, 0, 0) == ' ');
  41. caca_put_char(cv, 0, 0, 'y');
  42. TEST(caca_get_char(cv, 0, 0) == 'y');
  43. caca_set_canvas_size(cv, 1000, 1000);
  44. TEST(caca_get_canvas_width(cv) == 1000);
  45. caca_put_char(cv, 999, 999, 'z');
  46. TEST(caca_get_char(cv, 999, 999) == 'z');
  47. caca_free_canvas(cv);
  48. fprintf(stderr, "%i tests, %i errors\n", tests, tests - passed);
  49. return 0;
  50. }