Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

64 Zeilen
1.5 KiB

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