diff --git a/modules/base/tests/test_generic_property.cc b/modules/base/tests/test_generic_property.cc index 783195848740092fb933cb151ac5f2f519572d7f..8b8f2a8b7f1ab4e0ce9689221029f37eb2db6bac 100644 --- a/modules/base/tests/test_generic_property.cc +++ b/modules/base/tests/test_generic_property.cc @@ -26,8 +26,7 @@ using namespace ost::mol; BOOST_AUTO_TEST_SUITE( base ) - -void test() +BOOST_AUTO_TEST_CASE( test_generic_property ) { EntityHandle eh=CreateEntity(); XCSEditor editor=eh.RequestXCSEditor(); @@ -63,10 +62,4 @@ void test() BOOST_CHECK(atomv.GetGenericBoolProperty("d")==true); } - -BOOST_AUTO_TEST_CASE( test_generic_property ) -{ - test(); -} - BOOST_AUTO_TEST_SUITE_END() diff --git a/modules/base/tests/test_string_ref.cc b/modules/base/tests/test_string_ref.cc index 31a7c37834cfd907734fa5ad9fbfa3eadd8982c2..afe85cb648be685671d60397d49e3578bb68be26 100644 --- a/modules/base/tests/test_string_ref.cc +++ b/modules/base/tests/test_string_ref.cc @@ -28,7 +28,7 @@ using namespace ost; BOOST_AUTO_TEST_SUITE( base ) -void test_strref() +BOOST_AUTO_TEST_CASE( test_string_ref) { StringRef sr("12345", 5); BOOST_CHECK_EQUAL(sr.length(), size_t(5)); @@ -83,14 +83,7 @@ void test_strref() r2=StringRef("12.3.4", 6).to_float(); BOOST_CHECK(r2.first==false); r2=StringRef("12.34.", 6).to_float(); - BOOST_CHECK(r2.first==false); -} - - - -BOOST_AUTO_TEST_CASE( test_string_ref) -{ - test_strref(); + BOOST_CHECK(r2.first==false); } BOOST_AUTO_TEST_SUITE_END() diff --git a/modules/conop/tests/CMakeLists.txt b/modules/conop/tests/CMakeLists.txt index c540c20d7a1bbfbb04d3f24a6d9f78560f20af11..9fc8af3b0b5ed2b35ab2f965c903c5779c51282a 100644 --- a/modules/conop/tests/CMakeLists.txt +++ b/modules/conop/tests/CMakeLists.txt @@ -1,6 +1,5 @@ set(OST_CONOP_UNIT_TESTS test_heuristic_builder.cc - test_conop.cc tests.cc test_builder.cc ) diff --git a/modules/conop/tests/test_builder.cc b/modules/conop/tests/test_builder.cc index ca4a5c5373a35f4f948db958f859160453bbbf2d..0c0c54cf0357931f674235d381a627404c709406 100644 --- a/modules/conop/tests/test_builder.cc +++ b/modules/conop/tests/test_builder.cc @@ -27,17 +27,6 @@ using namespace ost; using namespace ost::conop; using namespace ost::mol; - -// namespace boost { -// namespace unit_test { -// #ifdef BOOST_TEST_ALTERNATIVE_INIT_API -// typedef bool (*init_unit_test_func)(); -// #else -// typedef test_suite* (*init_unit_test_func)( int, char* [] ); -// #endif -// } -// } - BOOST_AUTO_TEST_SUITE( conop ) @@ -55,11 +44,4 @@ BOOST_AUTO_TEST_CASE( test_builder ) BOOST_CHECK_EQUAL(Builder::GuessAtomElement("CA", true), "CA"); } -// test_suite* test_builder() -// { - // test_suite* ts=BOOST_TEST_SUITE("builder"); - // ts->add(BOOST_TEST_CASE(&test_guess_atom_element)); - // return ts; -// } - BOOST_AUTO_TEST_SUITE_END() diff --git a/modules/conop/tests/test_conop.cc b/modules/conop/tests/test_conop.cc deleted file mode 100644 index f85bceb95e232133e48da9f701238fadb3b2705e..0000000000000000000000000000000000000000 --- a/modules/conop/tests/test_conop.cc +++ /dev/null @@ -1,18 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ diff --git a/modules/conop/tests/test_heuristic_builder.cc b/modules/conop/tests/test_heuristic_builder.cc index bf4dae40fc8f4b5211b80736ba79847b0a2a17e2..473ff46dd7c1addd82403eeebdfd09e15793ccdb 100644 --- a/modules/conop/tests/test_heuristic_builder.cc +++ b/modules/conop/tests/test_heuristic_builder.cc @@ -140,31 +140,11 @@ void verify_connectivity(const ResidueHandle& res) } } -void test_distance_based_connect() { +BOOST_AUTO_TEST_SUITE( conop ) - EntityHandle e=CreateEntity(); - ChainHandle c=e.RequestXCSEditor().InsertChain("A"); - ResidueHandle ile=make_leu(c); - ResidueHandle arg=make_arg(c); - AtomHandleList atoms=arg.GetAtomList(); - // fake the atom names. so we have to rely solely on distance based - // information. - for (size_t i=0; i<atoms.size(); ++i) { - atoms[i].SetName("X"+atoms[i].GetName()); - } - atoms=ile.GetAtomList(); - for (size_t i=0; i<atoms.size(); ++i) { - atoms[i].SetName("X"+atoms[i].GetName()); - } - HeuristicBuilder heuristic_builder; - heuristic_builder.ConnectAtomsOfResidue(arg); - verify_connectivity_x(arg); - heuristic_builder.ConnectAtomsOfResidue(ile); - verify_connectivity_x(ile); -} - -void test_name_based_connect() { +BOOST_AUTO_TEST_CASE(name_based_connect) +{ EntityHandle e=CreateEntity(); ChainHandle c=e.RequestXCSEditor().InsertChain("A"); ResidueHandle ile=make_leu(c); @@ -182,17 +162,6 @@ void test_name_based_connect() { verify_connectivity(ile); } - -BOOST_AUTO_TEST_SUITE( conop ) - - -BOOST_AUTO_TEST_CASE(test_heuristic_connect) -{ - test_name_based_connect(); - // uncommented for now, does not seem to work that nicely. - // test_distance_based_connect(); - Logger::Instance().PopVerbosityLevel(); -} BOOST_AUTO_TEST_CASE(test_assign_torsions){ EntityHandle e=CreateEntity(); ChainHandle c=e.RequestXCSEditor().InsertChain("A"); diff --git a/modules/io/tests/test_clustal.cc b/modules/io/tests/test_clustal.cc index 44ea4fdb457c0b001b17cf1bd4528ae2569c07b1..cb9fd13ee9f2dc219ff863b526da0c751f7c4a3c 100644 --- a/modules/io/tests/test_clustal.cc +++ b/modules/io/tests/test_clustal.cc @@ -32,7 +32,10 @@ const static String MOUSE="MFQAFPGDYDSGSRCSSSPSAESQYLSSVDSFGSPPTAAASQECAGLGEMPGS const static String HUMAN="MFQAFPGDYDSGSRCSSSPSAESQYLSSVDSFGSPPTAAASQECAGLGEMPGSFVPTVTAITTSQDLQWLVQPTLISSMAQSQGQPLASQPPVVDPYDMPGTSYSTPGMSGYSSGGASGS"; -void test_clustal() +BOOST_AUTO_TEST_SUITE( io ) + + +BOOST_AUTO_TEST_CASE(clustal) { BOOST_CHECK(ClustalIOHandler::ProvidesImport("","clustal")); BOOST_CHECK(ClustalIOHandler::ProvidesImport("alignment.aln")); @@ -46,13 +49,4 @@ void test_clustal() BOOST_CHECK_EQUAL(aln.GetSequence(1).GetString(), HUMAN); } - -BOOST_AUTO_TEST_SUITE( io ) - - -BOOST_AUTO_TEST_CASE(test_io_clustal) -{ - test_clustal(); -} - BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/modules/io/tests/test_io_crd.cc b/modules/io/tests/test_io_crd.cc index eb667b39dd4fb3bc7e3d1bdefc92db91b7e159fc..55ba18cfb65ed409da2f5441df51e6abfad81250 100644 --- a/modules/io/tests/test_io_crd.cc +++ b/modules/io/tests/test_io_crd.cc @@ -24,7 +24,11 @@ using namespace ost; using namespace ost::io; -void test_crd() + +BOOST_AUTO_TEST_SUITE( io ) + + +BOOST_AUTO_TEST_CASE(test_io_crd) { const String fname("testfiles/test_in.crd"); @@ -35,12 +39,4 @@ void test_crd() std::vector<mol::AtomHandle> alist = crdr.GetSequentialAtoms(); } -BOOST_AUTO_TEST_SUITE( io ) - - -BOOST_AUTO_TEST_CASE(test_io_crd) -{ - test_crd(); -} - BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/modules/io/tests/test_io_pdb.cc b/modules/io/tests/test_io_pdb.cc index 05a31189ec8658c48e1966ad03dcc7079f9b1f75..5bc9f8e4c7c9cae6968ed20359d32972b32e76ed 100644 --- a/modules/io/tests/test_io_pdb.cc +++ b/modules/io/tests/test_io_pdb.cc @@ -25,8 +25,9 @@ using boost::unit_test_framework::test_suite; using namespace ost; using namespace ost::io; +BOOST_AUTO_TEST_SUITE( io ) -void test_pdb() +BOOST_AUTO_TEST_CASE(test_io_pdb) { const String fname("testfiles/test_in.pdb"); @@ -44,11 +45,4 @@ void test_pdb() pdbh.Import(eh,"testfiles/test_in.pdb"); } -BOOST_AUTO_TEST_SUITE( io ) - -BOOST_AUTO_TEST_CASE(test_io_pdb) -{ - test_pdb(); -} - BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/modules/io/tests/test_io_sdf.cc b/modules/io/tests/test_io_sdf.cc index 930b9e943bf16c3de2765790deb10fcb3ef4a6b5..4fcad509eedc32f6ac30b644ff562b51c98cdeb5 100644 --- a/modules/io/tests/test_io_sdf.cc +++ b/modules/io/tests/test_io_sdf.cc @@ -26,7 +26,10 @@ using namespace ost; using namespace ost::io; -void test_sdf() +BOOST_AUTO_TEST_SUITE( io ) + + +BOOST_AUTO_TEST_CASE(test_io_sdf) { const String fname("testfiles/test_in.sdf"); @@ -55,15 +58,6 @@ void test_sdf() BOOST_CHECK_EQUAL(boost::lexical_cast<Real>(boost::trim_copy (ch.GetGenericStringProperty("r_i_glide_rmsd"))), 0.543804f); - -} - -BOOST_AUTO_TEST_SUITE( io ) - - -BOOST_AUTO_TEST_CASE(test_io_sdf) -{ - test_sdf(); } BOOST_AUTO_TEST_SUITE_END() diff --git a/modules/io/tests/test_iomanager.cc b/modules/io/tests/test_iomanager.cc index 29eee9ba1abd5e3fcc4a7fc31b5ed96ae25ac9f3..2115646272f7a4b97c92d0b46357515a6230c62c 100644 --- a/modules/io/tests/test_iomanager.cc +++ b/modules/io/tests/test_iomanager.cc @@ -25,21 +25,15 @@ using boost::unit_test_framework::test_suite; using namespace ost; using namespace ost::io; -void test_manager() -{ - IOManager& iom = IOManager::Instance(); - BOOST_CHECK(iom.FindEntityImportHandler("model.pdb")); - BOOST_CHECK(iom.FindEntityImportHandler("model.PDB")); - BOOST_CHECK(iom.FindEntityImportHandler("model.ent")); -} - - BOOST_AUTO_TEST_SUITE( io ) -BOOST_AUTO_TEST_CASE(test_io_manager) +BOOST_AUTO_TEST_CASE(io_manager) { - test_manager(); + IOManager& iom = IOManager::Instance(); + BOOST_CHECK(iom.FindEntityImportHandler("model.pdb")); + BOOST_CHECK(iom.FindEntityImportHandler("model.PDB")); + BOOST_CHECK(iom.FindEntityImportHandler("model.ent")); } BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/modules/io/tests/test_star_parser.cc b/modules/io/tests/test_star_parser.cc index 8e7588631c02e93a973467be36bb60b2af0be00d..7c9864dabb0e520a4d8221c18784a4ec82fab254 100644 --- a/modules/io/tests/test_star_parser.cc +++ b/modules/io/tests/test_star_parser.cc @@ -30,36 +30,6 @@ using namespace ost; using namespace ost::io; -void test_star_split1() -{ - const char* line1=" "; - StringRef r1(line1, strlen(line1)); - std::vector<StringRef> parts; - BOOST_REQUIRE(StarParser::SplitLine(r1, parts)); - BOOST_REQUIRE(parts.size()==0); -} - -void test_star_split2() -{ - const char* line2="1 2"; - std::vector<StringRef> parts; - StringRef r2(line2, strlen(line2)); - BOOST_REQUIRE(StarParser::SplitLine(r2, parts)); - BOOST_REQUIRE(parts.size()==2); - BOOST_CHECK_EQUAL(parts[0], StringRef("1", 1)); - BOOST_CHECK_EQUAL(parts[1], StringRef("2", 1)); -} - -void test_star_split3() -{ - const char* line3="'1 2' "; - std::vector<StringRef> parts; - StringRef r3(line3, strlen(line3)); - BOOST_REQUIRE(StarParser::SplitLine(r3, parts)); - BOOST_REQUIRE(parts.size()==1); - BOOST_CHECK_EQUAL(parts[0], StringRef("1 2", 3)); -} - class DataItemTestParser: public StarParser { public: @@ -87,17 +57,6 @@ public: String s4; }; -void test_star_data_item() -{ - std::ifstream s("testfiles/data-item.cif"); - DataItemTestParser star_p(s); - star_p.Parse(); - BOOST_CHECK_EQUAL(star_p.s1, "a"); - BOOST_CHECK_EQUAL(star_p.s2, "a b c"); - BOOST_CHECK_EQUAL(star_p.s3, "a\nb\nc"); - BOOST_CHECK_EQUAL(star_p.s4, "a'b"); -} - class LoopTestParser: public StarParser { public: LoopTestParser(std::istream& stream): StarParser(stream), count_(0) @@ -122,33 +81,6 @@ private: int count_; }; -void test_star_loop() -{ - std::ifstream s("testfiles/loop.cif"); - LoopTestParser star_p(s); - star_p.Parse(); - BOOST_CHECK_EQUAL(star_p.lines[0][0], "1"); - BOOST_CHECK_EQUAL(star_p.lines[0][1], "2"); - BOOST_CHECK_EQUAL(star_p.lines[0][2], "3"); - - BOOST_CHECK_EQUAL(star_p.lines[1][0], "4 x"); - BOOST_CHECK_EQUAL(star_p.lines[1][1], "5"); - BOOST_CHECK_EQUAL(star_p.lines[1][2], "6"); - - BOOST_CHECK_EQUAL(star_p.lines[2][0], "7"); - BOOST_CHECK_EQUAL(star_p.lines[2][1], "8"); - BOOST_CHECK_EQUAL(star_p.lines[2][2], "9"); - - BOOST_CHECK_EQUAL(star_p.lines[3][0], "10"); - BOOST_CHECK_EQUAL(star_p.lines[3][1], "11"); - BOOST_CHECK_EQUAL(star_p.lines[3][2], "12"); - - BOOST_CHECK_EQUAL(star_p.lines[4][0], "13"); - BOOST_CHECK_EQUAL(star_p.lines[4][1], "14"); - BOOST_CHECK_EQUAL(star_p.lines[4][2], "15"); -} - - class MultiDataParser : public StarParser { public: MultiDataParser(std::istream& stream): StarParser(stream), visit_one(false), @@ -170,39 +102,82 @@ public: bool visit_two; }; -void test_star_multi() -{ - std::ifstream s("testfiles/multi-data.cif"); - MultiDataParser star_p(s); - star_p.Parse(); - BOOST_CHECK(star_p.visit_one); - BOOST_CHECK(star_p.visit_two); -} - BOOST_AUTO_TEST_SUITE( io ); -BOOST_AUTO_TEST_CASE(star_split1){ - test_star_split1(); +BOOST_AUTO_TEST_CASE(star_split1) +{ + const char* line1=" "; + StringRef r1(line1, strlen(line1)); + std::vector<StringRef> parts; + BOOST_REQUIRE(StarParser::SplitLine(r1, parts)); + BOOST_REQUIRE(parts.size()==0); } -BOOST_AUTO_TEST_CASE(star_split2){ - test_star_split2(); +BOOST_AUTO_TEST_CASE(star_split2) +{ + const char* line2="1 2"; + std::vector<StringRef> parts; + StringRef r2(line2, strlen(line2)); + BOOST_REQUIRE(StarParser::SplitLine(r2, parts)); + BOOST_REQUIRE(parts.size()==2); + BOOST_CHECK_EQUAL(parts[0], StringRef("1", 1)); + BOOST_CHECK_EQUAL(parts[1], StringRef("2", 1)); } -BOOST_AUTO_TEST_CASE(star_split3){ - test_star_split3(); +BOOST_AUTO_TEST_CASE(star_split3) +{ + const char* line3="'1 2' "; + std::vector<StringRef> parts; + StringRef r3(line3, strlen(line3)); + BOOST_REQUIRE(StarParser::SplitLine(r3, parts)); + BOOST_REQUIRE(parts.size()==1); + BOOST_CHECK_EQUAL(parts[0], StringRef("1 2", 3)); } -BOOST_AUTO_TEST_CASE(star_data_item){ - test_star_data_item(); +BOOST_AUTO_TEST_CASE(star_data_item) +{ + std::ifstream s("testfiles/data-item.cif"); + DataItemTestParser star_p(s); + star_p.Parse(); + BOOST_CHECK_EQUAL(star_p.s1, "a"); + BOOST_CHECK_EQUAL(star_p.s2, "a b c"); + BOOST_CHECK_EQUAL(star_p.s3, "a\nb\nc"); + BOOST_CHECK_EQUAL(star_p.s4, "a'b"); } -BOOST_AUTO_TEST_CASE(star_multi){ - test_star_multi(); +BOOST_AUTO_TEST_CASE(star_multi) +{ + std::ifstream s("testfiles/multi-data.cif"); + MultiDataParser star_p(s); + star_p.Parse(); + BOOST_CHECK(star_p.visit_one); + BOOST_CHECK(star_p.visit_two); } -BOOST_AUTO_TEST_CASE(star_loop){ - test_star_loop(); +BOOST_AUTO_TEST_CASE(star_loop) +{ + std::ifstream s("testfiles/loop.cif"); + LoopTestParser star_p(s); + star_p.Parse(); + BOOST_CHECK_EQUAL(star_p.lines[0][0], "1"); + BOOST_CHECK_EQUAL(star_p.lines[0][1], "2"); + BOOST_CHECK_EQUAL(star_p.lines[0][2], "3"); + + BOOST_CHECK_EQUAL(star_p.lines[1][0], "4 x"); + BOOST_CHECK_EQUAL(star_p.lines[1][1], "5"); + BOOST_CHECK_EQUAL(star_p.lines[1][2], "6"); + + BOOST_CHECK_EQUAL(star_p.lines[2][0], "7"); + BOOST_CHECK_EQUAL(star_p.lines[2][1], "8"); + BOOST_CHECK_EQUAL(star_p.lines[2][2], "9"); + + BOOST_CHECK_EQUAL(star_p.lines[3][0], "10"); + BOOST_CHECK_EQUAL(star_p.lines[3][1], "11"); + BOOST_CHECK_EQUAL(star_p.lines[3][2], "12"); + + BOOST_CHECK_EQUAL(star_p.lines[4][0], "13"); + BOOST_CHECK_EQUAL(star_p.lines[4][1], "14"); + BOOST_CHECK_EQUAL(star_p.lines[4][2], "15"); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/modules/mol/alg/tests/test_superposition.cc b/modules/mol/alg/tests/test_superposition.cc index db4be134e7ed52adff787a28911574632eee6c13..c410a768ac11b18155fca970f9f1fe23b1c0ec40 100644 --- a/modules/mol/alg/tests/test_superposition.cc +++ b/modules/mol/alg/tests/test_superposition.cc @@ -81,7 +81,10 @@ struct Fixture { }; -void test_superpositionSVD() { +BOOST_AUTO_TEST_SUITE( mol_alg ) + +BOOST_AUTO_TEST_CASE(superposition_svd) +{ Fixture f1, f2; EntityView ev1 = f1.e.CreateFullView(); XCSEditor ed=f1.e.RequestXCSEditor(); @@ -102,11 +105,4 @@ void test_superpositionSVD() { BOOST_CHECK(abs(res.rmsd)<0.0001); } -BOOST_AUTO_TEST_SUITE( mol_alg ) - -BOOST_AUTO_TEST_CASE(test_superpositionSVD) -{ - test_superpositionSVD(); -} - BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/modules/seq/base/tests/test_sequence.cc b/modules/seq/base/tests/test_sequence.cc index 5818d2ca148754c9919b4e92134a08f527528b2f..666ebe6c49610d07ee93f39664d92d5b3be04abe 100644 --- a/modules/seq/base/tests/test_sequence.cc +++ b/modules/seq/base/tests/test_sequence.cc @@ -26,9 +26,9 @@ using namespace ost; using namespace ost::seq; +BOOST_AUTO_TEST_SUITE( seq ) - -void test_sequence_trivial() +BOOST_AUTO_TEST_CASE(seq_triv) { BOOST_CHECK_NO_THROW(CreateSequence("S1", "-afbcdefghijkLMNOPQRSTUV-")); BOOST_CHECK_THROW(CreateSequence("S1", "1"), InvalidSequence); @@ -36,7 +36,7 @@ void test_sequence_trivial() BOOST_CHECK_THROW(CreateSequence("S1", " "), InvalidSequence); } -void test_sequence_get_number() +BOOST_AUTO_TEST_CASE(seq_getnum) { SequenceHandle s=CreateSequence("S1", "-afc--de-f"); BOOST_CHECK_THROW(s.GetResidueIndex(0), Error); @@ -50,7 +50,7 @@ void test_sequence_get_number() BOOST_CHECK_THROW(s.GetResidueIndex(10), Error); } -void test_sequence_get_pos() +BOOST_AUTO_TEST_CASE(seq_getpos) { SequenceHandle s=CreateSequence("S1", "-afc--de-f"); @@ -62,21 +62,4 @@ void test_sequence_get_pos() BOOST_CHECK(s.GetPos(5)==9); } -BOOST_AUTO_TEST_SUITE( seq ) - -BOOST_AUTO_TEST_CASE(seq_triv) -{ - test_sequence_trivial(); -} - -BOOST_AUTO_TEST_CASE(seq_getnum) -{ - test_sequence_get_number(); -} - -BOOST_AUTO_TEST_CASE(seq_getpos) -{ - test_sequence_get_pos(); -} - BOOST_AUTO_TEST_SUITE_END()