diff --git a/tests/.gitignore b/tests/.gitignore index d9b55c2..2c539b2 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,2 +1,3 @@ simple cucul-test +caca-test diff --git a/tests/Makefile.am b/tests/Makefile.am index ab8433e..0be9d40 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,9 +1,10 @@ # $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 -cppunit_tests = cucul-test +cppunit_tests = cucul-test caca-test endif noinst_PROGRAMS = simple $(cppunit_tests) @@ -14,6 +15,10 @@ simple_SOURCES = simple.c simple_LDADD = ../cucul/libcucul.la 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) +caca_test_SOURCES = caca-test.cpp driver.cpp +caca_test_CXXFLAGS = $(CPPUNIT_CFLAGS) +caca_test_LDADD = ../caca/libcaca.la $(CPPUNIT_LIBS) + diff --git a/tests/caca-test.cpp b/tests/caca-test.cpp new file mode 100644 index 0000000..0bd5c0c --- /dev/null +++ b/tests/caca-test.cpp @@ -0,0 +1,29 @@ +/* + * caca-test testsuite program for libcaca + * Copyright (c) 2008 Sam Hocevar + * 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 +#include + +int main(int argc, char *argv[]) +{ + CppUnit::TextTestRunner runner; + runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); + + runner.run(); + + return 0; +} + diff --git a/tests/canvas.cpp b/tests/canvas.cpp index a1338d9..a72f115 100644 --- a/tests/canvas.cpp +++ b/tests/canvas.cpp @@ -1,7 +1,6 @@ /* * cucul-test testsuite program for libcucul * Copyright (c) 2008 Sam Hocevar - * Copyright (c) 2008 Sam Hocevar * All Rights Reserved * * $Id$ @@ -52,20 +51,20 @@ public: cucul_canvas_t *cv; 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); - 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); - 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); - 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); } diff --git a/tests/driver.cpp b/tests/driver.cpp new file mode 100644 index 0000000..f535bf2 --- /dev/null +++ b/tests/driver.cpp @@ -0,0 +1,48 @@ +/* + * caca-test testsuite program for libcaca + * Copyright (c) 2008 Sam Hocevar + * 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 +#include +#include +#include + +#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); +