source: libcaca/trunk/test/all.c @ 1389

Last change on this file since 1389 was 1389, checked in by Sam Hocevar, 16 years ago
  • Started writing a full API test. Not sure where it'll lead.
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1/*
2 *  all           full libcaca API test
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: all.c 1389 2006-11-13 23:00:02Z sam $
7 *
8 *  This program is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14#include "config.h"
15#include "common.h"
16
17#if !defined(__KERNEL__)
18#   include <stdio.h>
19#endif
20
21#include "cucul.h"
22#include "caca.h"
23
24#define ITER 1000
25
26int main(int argc, char *argv[])
27{
28    cucul_canvas_t *cv;
29    unsigned int i, w, h;
30
31    /* cucul_create_canvas */
32    fprintf(stderr, "testing cucul_create_canvas()\n");
33    for(i = 0; i < ITER; i++)
34    {
35        w = cucul_rand(1, 1000);
36        h = cucul_rand(1, 1000);
37        cv = cucul_create_canvas(w, h);
38        cucul_put_char(cv, w - 1, h - 1, 'x');
39        if(cucul_get_char(cv, w - 1, h - 1) != 'x')
40            fprintf(stderr, "  failed (%ux%u)\n", w, h);
41        cucul_free_canvas(cv);
42    }
43
44    fprintf(stderr, "all tests passed\n");
45    return 0;
46}
47
Note: See TracBrowser for help on using the repository browser.