@@ -1,2 +1,3 @@ | |||||
simple | simple | ||||
cucul-test | cucul-test | ||||
caca-test |
@@ -1,9 +1,10 @@ | |||||
# $Id$ | # $Id$ | ||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul | |||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ | |||||
-I$(top_srcdir)/caca | |||||
if USE_CPPUNIT | if USE_CPPUNIT | ||||
cppunit_tests = cucul-test | |||||
cppunit_tests = cucul-test caca-test | |||||
endif | endif | ||||
noinst_PROGRAMS = simple $(cppunit_tests) | noinst_PROGRAMS = simple $(cppunit_tests) | ||||
@@ -14,6 +15,10 @@ simple_SOURCES = simple.c | |||||
simple_LDADD = ../cucul/libcucul.la | simple_LDADD = ../cucul/libcucul.la | ||||
cucul_test_SOURCES = cucul-test.cpp canvas.cpp | cucul_test_SOURCES = cucul-test.cpp canvas.cpp | ||||
cucul_test_CPPFLAGS = $(CPPUNIT_CFLAGS) | |||||
cucul_test_CXXFLAGS = $(CPPUNIT_CFLAGS) | |||||
cucul_test_LDADD = ../cucul/libcucul.la $(CPPUNIT_LIBS) | cucul_test_LDADD = ../cucul/libcucul.la $(CPPUNIT_LIBS) | ||||
caca_test_SOURCES = caca-test.cpp driver.cpp | |||||
caca_test_CXXFLAGS = $(CPPUNIT_CFLAGS) | |||||
caca_test_LDADD = ../caca/libcaca.la $(CPPUNIT_LIBS) | |||||
@@ -0,0 +1,29 @@ | |||||
/* | |||||
* caca-test testsuite program for libcaca | |||||
* Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | |||||
* | |||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | |||||
*/ | |||||
#include "config.h" | |||||
#include <cppunit/TextTestRunner.h> | |||||
#include <cppunit/extensions/TestFactoryRegistry.h> | |||||
int main(int argc, char *argv[]) | |||||
{ | |||||
CppUnit::TextTestRunner runner; | |||||
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); | |||||
runner.run(); | |||||
return 0; | |||||
} | |||||
@@ -1,7 +1,6 @@ | |||||
/* | /* | ||||
* cucul-test testsuite program for libcucul | * cucul-test testsuite program for libcucul | ||||
* Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | * Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | ||||
* Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | * $Id$ | ||||
@@ -52,20 +51,20 @@ public: | |||||
cucul_canvas_t *cv; | cucul_canvas_t *cv; | ||||
cv = cucul_create_canvas(0, 0); | cv = cucul_create_canvas(0, 0); | ||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 0U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 0U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 0); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 0); | |||||
cucul_set_canvas_size(cv, 1, 1); | cucul_set_canvas_size(cv, 1, 1); | ||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 1U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 1U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 1); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 1); | |||||
cucul_set_canvas_size(cv, 1234, 1001); | cucul_set_canvas_size(cv, 1234, 1001); | ||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 1234U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 1001U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 1234); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 1001); | |||||
cucul_set_canvas_size(cv, 0, 0); | cucul_set_canvas_size(cv, 0, 0); | ||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 0U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 0U); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_width(cv), 0); | |||||
CPPUNIT_ASSERT_EQUAL(cucul_get_canvas_height(cv), 0); | |||||
cucul_free_canvas(cv); | cucul_free_canvas(cv); | ||||
} | } | ||||
@@ -0,0 +1,48 @@ | |||||
/* | |||||
* caca-test testsuite program for libcaca | |||||
* Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | |||||
* | |||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | |||||
*/ | |||||
#include "config.h" | |||||
#include <cppunit/extensions/HelperMacros.h> | |||||
#include <cppunit/TestCaller.h> | |||||
#include <cppunit/TestCase.h> | |||||
#include <cppunit/TestSuite.h> | |||||
#include "caca.h" | |||||
class DriverTest : public CppUnit::TestCase | |||||
{ | |||||
CPPUNIT_TEST_SUITE(DriverTest); | |||||
CPPUNIT_TEST(test_list); | |||||
CPPUNIT_TEST_SUITE_END(); | |||||
public: | |||||
DriverTest() : CppUnit::TestCase("Driver Test") {} | |||||
void setUp() {} | |||||
void tearDown() {} | |||||
void test_list() | |||||
{ | |||||
char const * const * list; | |||||
list = caca_get_display_driver_list(); | |||||
CPPUNIT_ASSERT(list != NULL); | |||||
CPPUNIT_ASSERT(list[0] != NULL); | |||||
} | |||||
}; | |||||
CPPUNIT_TEST_SUITE_REGISTRATION(DriverTest); | |||||