From 0a3e9d5c99049aaf872dcbf096c9fb4e789d3e44 Mon Sep 17 00:00:00 2001 From: ikemo Date: Sun, 7 Dec 2003 02:38:05 +0000 Subject: [PATCH] add tests git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@621 56b19765-1e22-0410-a548-a0f45d66c51a --- kita/src/libkita/tests/Makefile.am | 4 +-- kita/src/libkita/tests/boardtest.cpp | 44 +++++++++++++++++++++++++++++++++ kita/src/libkita/tests/boardtest.h | 38 ++++++++++++++++++++++++++++ kita/src/libkita/tests/test_libkita.cpp | 2 ++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 kita/src/libkita/tests/boardtest.cpp create mode 100644 kita/src/libkita/tests/boardtest.h diff --git a/kita/src/libkita/tests/Makefile.am b/kita/src/libkita/tests/Makefile.am index 2d02a46..ad9b3ec 100644 --- a/kita/src/libkita/tests/Makefile.am +++ b/kita/src/libkita/tests/Makefile.am @@ -4,5 +4,5 @@ check_PROGRAMS = test_libkita KDE_CXXFLAGS = $(USE_EXCEPTIONS) test_libkita_LDADD = $(top_builddir)/kita/src/libkita/libkita.la -lkio -lqt-mt -lcppunit -test_libkita_SOURCES = test_libkita.cpp k2ch_articlefiletest.cpp urlconverttest.cpp commenttest.cpp threadtest.cpp -noinst_HEADERS = k2ch_articlefiletest.h urlconverttest.h commenttest.h threadtest.h +test_libkita_SOURCES = test_libkita.cpp k2ch_articlefiletest.cpp urlconverttest.cpp commenttest.cpp threadtest.cpp boardtest.cpp +noinst_HEADERS = k2ch_articlefiletest.h urlconverttest.h commenttest.h threadtest.h boardtest.h diff --git a/kita/src/libkita/tests/boardtest.cpp b/kita/src/libkita/tests/boardtest.cpp new file mode 100644 index 0000000..ee40ce4 --- /dev/null +++ b/kita/src/libkita/tests/boardtest.cpp @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2003 by Hideki Ikemoto * + * ikemo@wakaba.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "boardtest.h" + +using namespace Kita; + +void BoardTest::setUp() +{ + m_normal = new Board( KURL( "http://pc.2ch.net/linux/"), "Linux" ); +} + +void BoardTest::tearDown() +{ + delete m_normal; +} + +void BoardTest::testID() +{ + CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_normal->id() ); +} + +void BoardTest::testName() +{ + CPPUNIT_ASSERT_EQUAL( QString( "Linux" ), m_normal->name() ); +} + +void BoardTest::testSubjectTxtURL() +{ + CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/subject.txt" ), + m_normal->subjectTxtURL().url() ); +} + +void BoardTest::testURL() +{ + CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/"), + m_normal->url().url() ); +} diff --git a/kita/src/libkita/tests/boardtest.h b/kita/src/libkita/tests/boardtest.h new file mode 100644 index 0000000..a8028c3 --- /dev/null +++ b/kita/src/libkita/tests/boardtest.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2003 by Hideki Ikemoto * + * ikemo@wakaba.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef BOARDTEST_H +#define BOARDTEST_H + +#include +#include <../board.h> + +/** +@author Hideki Ikemoto +*/ +class BoardTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE( BoardTest ); + CPPUNIT_TEST( testID ); + CPPUNIT_TEST( testName ); + CPPUNIT_TEST( testSubjectTxtURL ); + CPPUNIT_TEST( testURL ); + CPPUNIT_TEST_SUITE_END(); + + Kita::Board* m_normal; +public: + void setUp(); + void tearDown(); + + void testID(); + void testName(); + void testSubjectTxtURL(); + void testURL(); +}; + +#endif diff --git a/kita/src/libkita/tests/test_libkita.cpp b/kita/src/libkita/tests/test_libkita.cpp index fae9ffe..5d1f2e5 100644 --- a/kita/src/libkita/tests/test_libkita.cpp +++ b/kita/src/libkita/tests/test_libkita.cpp @@ -15,6 +15,7 @@ #include "urlconverttest.h" #include "commenttest.h" #include "threadtest.h" +#include "boardtest.h" int main( int argc, char* argv[] ) { @@ -24,6 +25,7 @@ int main( int argc, char* argv[] ) runner.addTest( URLConvertTest::suite() ); runner.addTest( CommentTest::suite() ); runner.addTest( ThreadTest::suite() ); + runner.addTest( BoardTest::suite() ); runner.run( "" ); return 0; } -- 2.11.0