You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.6 KiB

  1. /*
  2. * all full libcaca API test
  3. * Copyright (c) 2006 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. # include <stdio.h>
  18. # include <string.h>
  19. #endif
  20. #include "cucul.h"
  21. #include "caca.h"
  22. #define ITER 128
  23. int main(int argc, char *argv[])
  24. {
  25. cucul_canvas_t *cv;
  26. unsigned int i, j, w, h;
  27. fprintf(stderr, "testing cucul_create_canvas()\n");
  28. for(i = 0; i < ITER; i++)
  29. {
  30. w = cucul_rand(1, 1000);
  31. h = cucul_rand(1, 1000);
  32. cv = cucul_create_canvas(w, h);
  33. cucul_put_char(cv, w - 1, h - 1, 'x');
  34. if(cucul_get_char(cv, w - 1, h - 1) != 'x')
  35. fprintf(stderr, " failed (%ux%u)\n", w, h);
  36. cucul_free_canvas(cv);
  37. }
  38. fprintf(stderr, "testing cucul_set_frame_name()\n");
  39. cv = cucul_create_canvas(1, 1);
  40. for(i = 0; i < ITER; i++)
  41. {
  42. cucul_create_frame(cv, 0);
  43. for(j = 0; j < ITER; j++)
  44. {
  45. char buf[BUFSIZ];
  46. w = cucul_rand(1, 1000);
  47. memset(buf, 'x', w);
  48. buf[w] = '\0';
  49. cucul_set_frame_name(cv, buf);
  50. }
  51. }
  52. cucul_free_canvas(cv);
  53. fprintf(stderr, "all tests passed\n");
  54. return 0;
  55. }