"<name>Linux</name>\n"
"</board>\n"
"</thread>\n" );
+
+ m_fromxml2 = Thread::fromXml( m_fromxml.toXmlFragment() );
+
+ m_fromxml3 = Thread::fromXml( "<thread xmlns=\"http://kita.sourceforge.jp/ns/thread\">\n"
+ " <daturl>http://pc.2ch.net/linux/dat/1022744633.dat</daturl>\n"
+ " <name>2ch browser thread</name>\n"
+ " <resnum>700</resnum>\n"
+ " <board xmlns=\"http://kita.sourceforge.jp/ns/board\">\n"
+ " <url>http://pc.2ch.net/linux/</url>\n"
+ " <name>Linux</name>\n"
+ " </board>\n"
+ "</thread>\n" );
}
void ThreadTest::tearDown()
m_noboard->datURL().url() );
CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/dat/1022744633.dat"),
m_fromxml.datURL().url() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/dat/1022744633.dat"),
+ m_fromxml2.datURL().url() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/dat/1022744633.dat"),
+ m_fromxml3.datURL().url() );
}
void ThreadTest::testURL()
m_noboard->url() );
CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/test/read.cgi/linux/1022744633/"),
m_fromxml.url() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/test/read.cgi/linux/1022744633/"),
+ m_fromxml2.url() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/test/read.cgi/linux/1022744633/"),
+ m_fromxml3.url() );
}
void ThreadTest::testDatID()
CPPUNIT_ASSERT_EQUAL( QString( "1069738960" ), m_normal->datID() );
CPPUNIT_ASSERT_EQUAL( QString( "1069738960" ), m_noboard->datID() );
CPPUNIT_ASSERT_EQUAL( QString( "1022744633" ), m_fromxml.datID() );
+ CPPUNIT_ASSERT_EQUAL( QString( "1022744633" ), m_fromxml2.datID() );
+ CPPUNIT_ASSERT_EQUAL( QString( "1022744633" ), m_fromxml3.datID() );
}
void ThreadTest::testResNum()
CPPUNIT_ASSERT_EQUAL( 0, m_normal->resNum() );
CPPUNIT_ASSERT_EQUAL( 0, m_noboard->resNum() );
CPPUNIT_ASSERT_EQUAL( 700, m_fromxml.resNum() );
+ CPPUNIT_ASSERT_EQUAL( 700, m_fromxml2.resNum() );
+ CPPUNIT_ASSERT_EQUAL( 700, m_fromxml3.resNum() );
}
void ThreadTest::testName()
m_noboard->name() );
CPPUNIT_ASSERT_EQUAL( QString( "2ch browser thread" ),
m_fromxml.name() );
+ CPPUNIT_ASSERT_EQUAL( QString( "2ch browser thread" ),
+ m_fromxml2.name() );
+ CPPUNIT_ASSERT_EQUAL( QString( "2ch browser thread" ),
+ m_fromxml3.name() );
}
void ThreadTest::testBoardName()
CPPUNIT_ASSERT_EQUAL( QString( "Linux" ), m_normal->boardName() );
CPPUNIT_ASSERT_EQUAL( QString::null, m_noboard->boardName() );
CPPUNIT_ASSERT_EQUAL( QString( "Linux" ), m_fromxml.boardName() );
+ CPPUNIT_ASSERT_EQUAL( QString( "Linux" ), m_fromxml2.boardName() );
+ CPPUNIT_ASSERT_EQUAL( QString( "Linux" ), m_fromxml3.boardName() );
}
void ThreadTest::testBoardURL()
CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/" ), m_normal->boardURL() );
CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/" ), m_noboard->boardURL() );
CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/" ), m_fromxml.boardURL() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/" ), m_fromxml2.boardURL() );
+ CPPUNIT_ASSERT_EQUAL( QString( "http://pc.2ch.net/linux/" ), m_fromxml3.boardURL() );
}
void ThreadTest::testBoardID()
CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_normal->boardID() );
CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_noboard->boardID() );
CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_fromxml.boardID() );
+ CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_fromxml2.boardID() );
+ CPPUNIT_ASSERT_EQUAL( QString( "linux" ), m_fromxml3.boardID() );
}
bool Thread::test()
{
kdDebug() << "Thread::test()" << endl;
- Thread thread = Thread::fromXml( "<thread xmlns=\"http://kita.sourceforge.jp/ns/thread\">\n"
- "<daturl>http://pc.2ch.net/linux/dat/1022744633.dat</daturl>\n"
- "<name>2ch browser thread</name>\n"
- "<resnum>700</resnum>\n"
- "<board xmlns=\"http://kita.sourceforge.jp/ns/board\">\n"
- "<url>http://pc.2ch.net/linux/</url>\n"
- "<name>Linux</name>\n"
- "</board>\n"
- "</thread>\n" );
-
- Thread thread2 = Thread::fromXml( thread.toXmlFragment() );
-
- // TODO: ¤³¤³¤Ç»È¤ï¤ì¤Æ¤¤¤ëkdError¤Î»³¤Ï²¿¤È¤«¤·¤¿¤¤¡£
- if( thread2.datURL().url() != "http://pc.2ch.net/linux/dat/1022744633.dat" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread2.url() != "http://pc.2ch.net/test/read.cgi/linux/1022744633/" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread2.name() != "2ch browser thread" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread2.resNum() != 700 ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread2.getBoard()->url().url() != "http://pc.2ch.net/linux/" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread2.getBoard()->name() != "Linux" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
-
- kdDebug() << thread.toXmlFragment() << endl;
-
- thread = Thread::fromXml( "<thread xmlns=\"http://kita.sourceforge.jp/ns/thread\">\n"
- " <daturl>http://pc.2ch.net/linux/dat/1022744633.dat</daturl>\n"
- " <name>2ch browser thread</name>\n"
- " <resnum>700</resnum>\n"
- " <board xmlns=\"http://kita.sourceforge.jp/ns/board\">\n"
- " <url>http://pc.2ch.net/linux/</url>\n"
- " <name>Linux</name>\n"
- " </board>\n"
- "</thread>\n" );
-
- if( thread.datURL().url() != "http://pc.2ch.net/linux/dat/1022744633.dat" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread.url() != "http://pc.2ch.net/test/read.cgi/linux/1022744633/" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread.name() != "2ch browser thread" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread.resNum() != 700 ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread.getBoard()->url().url() != "http://pc.2ch.net/linux/" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
- if( thread.getBoard()->name() != "Linux" ) {
- kdError() << "inValid: line=" << __LINE__ << endl;
- }
return true;
}