void RunIsBetweenTestSuite() { auto IsBetweenTestSuite = max::Testing::TestSuite{ "max::Algorithms::IsBetween test suite" }; IsBetweenTestSuite.AddTest( max::Testing::Test{ "inside range", []( max::Testing::Test & CurrentTest ) { CurrentTest.MAX_TESTING_ASSERT( max::Algorithms::IsBetween( 10, { 1, 100 } ) ); } } ); IsBetweenTestSuite.AddTest( max::Testing::Test{ "before range", []( max::Testing::Test & CurrentTest ) { CurrentTest.MAX_TESTING_ASSERT( ! max::Algorithms::IsBetween( 0, { 1, 100 } ) ); } } ); IsBetweenTestSuite.AddTest( max::Testing::Test{ "after range", []( max::Testing::Test & CurrentTest ) { CurrentTest.MAX_TESTING_ASSERT( ! max::Algorithms::IsBetween( 200, { 1, 100 } ) ); } } ); IsBetweenTestSuite.AddTest( max::Testing::Test{ "minimum and maximum switched", []( max::Testing::Test & CurrentTest ) { CurrentTest.MAX_TESTING_ASSERT( ! max::Algorithms::IsBetween( 10, { 100, 1 } ) ); } } ); IsBetweenTestSuite.RunTests(); }
bool CLogTest::Initialise(void) { AddTest("Default log", DefaultLog); AddTest("Custom log", CustomLog); return CUnitTest::Initialise(); }
int main( int argc, char** argv ) { InitTests(argc, argv); AddTest("Format() works correct.", FormatTest); AddTest("Log handler can handle log lines.", LogHandlerTest); AddTest("CopyString() is correct.", CopyStringTest); return RunTests(); }
VOID SetupNetlogonTests(PTEST t) { AddTest(t, "NETR-ENUM-TRUSTED-DOM" , TestNetlogonEnumTrustedDomains); AddTest(t, "NETR-DSR-ENUM-DOMTRUSTS", TestNetlogonEnumDomainTrusts); AddTest(t, "NETR-SAM-LOGON-INTERACTIVE", TestNetlogonSamLogonInteractive); AddTest(t, "NETR-SAM-LOGON-INTERACTIVE-EX", TestNetlogonSamLogonInteractiveEx); AddTest(t, "NETR-DSR-GET-DC-NAME", TestNetlogonGetDcName); }
MemoryProtocolServiceTest() :TestSuite("RadonFramework::IO::MemoryProtocolService-Test"_rfs) { AddTest(MakeDelegate(this,&MemoryProtocolServiceTest::GenerateResource), "MemoryProtocolServiceTest::GenerateResource"_rfs, "GenerateResource"_rfs); AddTest(MakeDelegate(this, &MemoryProtocolServiceTest::GetResource), "MemoryProtocolServiceTest::GetResource"_rfs, "GetResource"_rfs); AddTest(MakeDelegate(this, &MemoryProtocolServiceTest::RemoveResource), "MemoryProtocolServiceTest::RemoveResource"_rfs, "RemoveResource"_rfs); }
Vector3TestGroup::Vector3TestGroup() : UnitTestGroup("Vector3 tests") { AddTest( "Dot Product", DotProduct ); AddTest( "Normalization", Normalization ); AddTest( "Cross product", CrossProduct ); AddTest( "Magnitude", Magnitude ); AddTest( "Operator overrides", Operators ); AddTest( "Addition, subtraction, negation, and modulo operator overrides", Arithmatic ); AddTest( "Multiplication operator overrides", Multiplication ); AddTest( "Division operator overrides", Division ); AddTest( "Division by zero", DivisionByZero ); AddTest( "Interpolation", Interpolation ); }
void TestSetCont::AddTest ( const TestCase& singleTestCase ) { AddTest( NextTestSetName(), singleTestCase ); }
void UniTest() { Suite ts; AddTest(ts); std::auto_ptr<Output> output(new XmlOutput); ts.run(*output, true); Test::XmlOutput* const xml_output = dynamic_cast<XmlOutput*>(output.get()); if (xml_output) { std::ofstream fout("./test_pellets.xml"); xml_output->generate(fout, true, "zpublic"); } }
DoubleSideStackAllocatorTest() :TestSuite("RadonFramework::Memory::DoubleSideStack-Test") { AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::Constructor), "DoubleSideStackAllocatorTest::Constructor", "Constructor"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::ClearBoth), "DoubleSideStackAllocatorTest::ClearBoth", "ClearBoth"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PushPersistant), "DoubleSideStackAllocatorTest::PushPersistant", "PushPersistant"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PushTemporary), "DoubleSideStackAllocatorTest::PushTemporary", "PushTemporary"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PopPersistant), "DoubleSideStackAllocatorTest::PopPersistant", "PopPersistant"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PopTemporary), "DoubleSideStackAllocatorTest::PopTemporary", "PopTemporary"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PeekPersistant), "DoubleSideStackAllocatorTest::PeekPersistant", "PeekPersistant"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PeekTemporary), "DoubleSideStackAllocatorTest::PeekTemporary", "PeekTemporary"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PeekSizePersistant), "DoubleSideStackAllocatorTest::PeekSizePersistant", "PeekSizePersistant"); AddTest(MakeDelegate(this, &DoubleSideStackAllocatorTest::PeekSizeTemporary), "DoubleSideStackAllocatorTest::PeekSizeTemporary", "PeekSizeTemporary"); }
int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); for (guint i = 0; i < G_N_ELEMENTS(example_messages); i++) { AddTest("TestNew", i, TestNew); AddTest("TestGetValues", i, TestGetValues); AddTest("TestLoad", i, TestLoad); AddTest("TestDump", i, TestDump); AddTest("TestRead", i, TestRead); AddTest("TestWrite", i, TestWrite); } return g_test_run(); }
int main(int argc, char *argv[]) { /* Initialize testing framework */ TestInit(argv[0], NULL, NULL); /* Tests are generally arranged from least to most complexity... */ AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL); AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code", NULL); AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL); AddTest("heap", test_heap, NULL, "Memory Heaps", NULL); AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL); AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL); AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL); AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); AddTest("coords", test_coords, cleanup_coords, "Dataspace coordinates", NULL); AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL); AddTest("select", test_select, cleanup_select, "Selections", NULL); AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); AddTest("reference", test_reference, cleanup_reference, "References", NULL); AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL); AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL); /* Display testing information */ TestInfo(argv[0]); /* Parse command line arguments */ TestParseCmdLine(argc,argv); /* Perform requested testing */ PerformTests(); /* Display test summary, if requested */ if (GetTestSummary()) TestSummary(); /* Clean up test files, if allowed */ if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) TestCleanup(); return (GetTestNumErrs()); } /* end main() */
void AddTransformTests() { AddTest("TranslateOp", TestTranslateOp); }
int main(int const argc, char const* const argv[]) { if (argc != 1 && argc != 2) { std::cerr << "usage: " << argv[0] << " [--json]" << std::endl; return 1; } falcon::TestSuite tests("Json Parser test suite"); #define AddTest(input, code, key, data, type) \ tests.add(new JsonParserTest(input, code, key, data, type)) AddTest("{\"key\" : \"nicolas\"}", 0, "key", "nicolas", JSON_STRING); AddTest("{ \"key1\" : false, \"key2\" : 1222, \"key3\" : \"data\"}" , 0, "key1", "", JSON_FALSE); AddTest("{ \"key1\" : false, \"key2\" : 1222, \"key3\" : \"data\"}" , 0, "key2", "1222", JSON_INT); AddTest("{ \"key1\" : false, \"key2\" : 1222, \"key3\" : \"data\"}" , 0, "key3", "data", JSON_STRING); AddTest("{ \"array\" : [] }", 0, "array", "", JSON_ARRAY_BEGIN); AddTest("{ \"object\" : {} }", 0, "object", "", JSON_OBJECT_BEGIN); AddTest("[ \"array\", 10, true ]", 0, "", "", 0); AddTest(longJsonInput, 0, "date", "2014", JSON_STRING); AddTest("{ ", 0, "", "", 0); AddTest("{ = ", EINVAL, "", "", 0); AddTest("{ \"key\" : unknow}", EINVAL, "", "", 0); tests.run(); if (argc == 2) { std::string option(argv[1]); if (option.compare("--json") == 0) { tests.printJsonOutput(std::cout); } else { std::cerr << "usage: " << argv[0] << " [--json]" << std::endl; return 1; } } else { tests.printStandardOutput(std::cout); } return 0; }
int main(int argc, char** argv) { // add all tests AddTest(new CamerasTest::CamerasTest); AddTest(new ConnectionsTest::ConnectionsTest); AddTest(new DisplayTest::DisplayTest); AddTest(new EventBindingsTest::EventBindingsTest); AddTest(new EventsTest::EventsTest); AddTest(new FollowPathTest::FollowPathTest); AddTest(new GuiTest::GuiTest); AddTest(new InputTest::InputTest); AddTest(new LoggerTest::LoggerTest); AddTest(new MouseCursorTest::MouseCursorTest); AddTest(new MusicFadeTest::MusicFadeTest); AddTest(new MusicTest::MusicTest); AddTest(new NamesTest::NamesTest); AddTest(new NetworkTest::NetworkTest); AddTest(new ParticlesTest::ParticlesTest); AddTest(new PhysicsSimpleTest::PhysicsSimpleTest); AddTest(new PhysicsStressTest::PhysicsStressTest); AddTest(new PrimitivesTest::PrimitivesTest); AddTest(new QObjectTest::QObjectTest); AddTest(new RandomTest::RandomTest); AddTest(new ResourceManagerTest::ResourceManagerTest); AddTest(new ScriptComponentTest::ScriptComponentTest); AddTest(new ScriptingTest::ScriptingTest); AddTest(new ShadowsTest::ShadowsTest); AddTest(new SignalsTest::SignalsTest); AddTest(new SoundTest::SoundTest); AddTest(new StatesTest::StatesTest); AddTest(new TextTest::TextTest); AddTest(new TimerTest::TimerTest); AddTest(new TerrainTest::TerrainTest); if(argc < 2) { std::cout << "TestFramework usage: " << std::endl; std::cout << " ./TestFramework <test name>" << std::endl; std::cout << std::endl << "Available tests:" << std::endl; for(auto iter = Tests.begin(); iter != Tests.end(); ++iter) { std::cout << " - " << dt::Utils::ToStdString(iter->first) << std::endl; } } else { bool failure = false; for(int i = 1; i < argc; ++i) { QString name(argv[i]); if(name == "client" || name == "server") // ignore parameters of network continue; std::cout << "Running test " + dt::Utils::ToStdString(name) + "..." << std::endl; Test* test = GetTest(name); if(test == nullptr) { std::cerr << "Test " + dt::Utils::ToStdString(name) + " not found. Skipping." << std::endl; } else if(!test->Run(argc, argv)) { failure = true; std::cerr << "Test " + dt::Utils::ToStdString(name) + " FAILED." << std::endl; } else { std::cout << "Test " + dt::Utils::ToStdString(name) + ": OK." << std::endl; } } if(failure) { std::cerr << std::endl << "Not all tests successful, check log for details." << std::endl; return 1; } } return 0; }
VOID SetupDsrTests(PTEST t) { AddTest(t, "DSR-ROLE-GET-PDC-INFO", TestDsrRoleGetPrimaryDomainInformation); }
int main(int argc, char **argv) { int mpi_size, mpi_rank; /* mpi variables */ H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; /* Un-buffer the stdout and stderr */ setbuf(stderr, NULL); setbuf(stdout, NULL); MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); dim0 = ROW_FACTOR*mpi_size; dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS) { printf("===================================\n"); printf("PHDF5 TESTS START\n"); printf("===================================\n"); } H5open(); h5_show_hostname(); /* Initialize testing framework */ TestInit(argv[0], usage, parse_options); /* Tests are generally arranged from least to most complexity... */ AddTest("mpiodup", test_fapl_mpio_dup, NULL, "fapl_mpio duplicate", NULL); AddTest("posixdup", test_fapl_mpiposix_dup, NULL, "fapl_mpiposix duplicate", NULL); AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE); AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); AddTest("cdsetw", dataset_writeAll, NULL, "dataset collective write", PARATESTFILE); AddTest("cdsetr", dataset_readAll, NULL, "dataset collective read", PARATESTFILE); AddTest("eidsetw", extend_writeInd, NULL, "extendible dataset independent write", PARATESTFILE); AddTest("eidsetr", extend_readInd, NULL, "extendible dataset independent read", PARATESTFILE); AddTest("ecdsetw", extend_writeAll, NULL, "extendible dataset collective write", PARATESTFILE); AddTest("ecdsetr", extend_readAll, NULL, "extendible dataset collective read", PARATESTFILE); AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE); AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file", PARATESTFILE); AddTest("fltread", test_filter_read, NULL, "parallel read of dataset written serially with filters", PARATESTFILE); #ifdef H5_HAVE_FILTER_DEFLATE AddTest("cmpdsetr", compress_readAll, NULL, "compressed dataset collective read", PARATESTFILE); #endif /* H5_HAVE_FILTER_DEFLATE */ ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, "multiple datasets write", &ndsets_params); ngroups_params.name = PARATESTFILE; ngroups_params.count = ngroups; AddTest("ngrpw", multiple_group_write, NULL, "multiple groups write", &ngroups_params); AddTest("ngrpr", multiple_group_read, NULL, "multiple groups read", &ngroups_params); AddTest("compact", compact_dataset, NULL, "compact dataset test", PARATESTFILE); collngroups_params.name = PARATESTFILE; collngroups_params.count = ngroups; AddTest("cngrpw", collective_group_write, NULL, "collective group and dataset write", &collngroups_params); AddTest("ingrpr", independent_group_read, NULL, "independent group and dataset read", &collngroups_params); AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); AddTest("fill", dataset_fillvalue, NULL, "dataset fill value", PARATESTFILE); AddTest("cchunk1", coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); AddTest("cchunk2", coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); AddTest("cchunk3", coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); AddTest("cchunk4", coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); if((mpi_size < 3)&& MAINPROCESS ) { printf("Collective chunk IO optimization APIs "); printf("needs at least 3 processes to participate\n"); printf("Collective chunk IO API tests will be skipped \n"); } AddTest((mpi_size <3)? "-cchunk5":"cchunk5" , coll_chunk5,NULL, "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", coll_chunk6,NULL, "multi-chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", coll_chunk7,NULL, "linked chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8", coll_chunk8,NULL, "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9", coll_chunk9,NULL, "multiple chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10", coll_chunk10,NULL, "multiple chunk collective IO transferring to independent IO",PARATESTFILE); /* irregular collective IO tests*/ AddTest("ccontw", coll_irregular_cont_write,NULL, "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr", coll_irregular_cont_read,NULL, "collective irregular contiguous read",PARATESTFILE); AddTest("cschunkw", coll_irregular_simple_chunk_write,NULL, "collective irregular simple chunk write",PARATESTFILE); AddTest("cschunkr", coll_irregular_simple_chunk_read,NULL, "collective irregular simple chunk read",PARATESTFILE); AddTest("ccchunkw", coll_irregular_complex_chunk_write,NULL, "collective irregular complex chunk write",PARATESTFILE); AddTest("ccchunkr", coll_irregular_complex_chunk_read,NULL, "collective irregular complex chunk read",PARATESTFILE); #if 0 if((mpi_size > 3) && MAINPROCESS) { printf("Collective irregular chunk IO tests haven't been tested \n"); printf(" for the number of process greater than 3.\n"); printf("Please try with the number of process \n"); printf(" no greater than 3 for collective irregular chunk IO test.\n"); printf("Collective irregular chunk tests will be skipped \n"); } AddTest((mpi_size > 3) ? "-ccontw" : "ccontw", coll_irregular_cont_write,NULL, "collective irregular contiguous write",PARATESTFILE); AddTest((mpi_size > 3) ? "-ccontr" : "ccontr", coll_irregular_cont_read,NULL, "collective irregular contiguous read",PARATESTFILE); AddTest((mpi_size > 3) ? "-cschunkw" : "cschunkw", coll_irregular_simple_chunk_write,NULL, "collective irregular simple chunk write",PARATESTFILE); AddTest((mpi_size > 3) ? "-cschunkr" : "cschunkr", coll_irregular_simple_chunk_read,NULL, "collective irregular simple chunk read",PARATESTFILE); AddTest((mpi_size > 3) ? "-ccchunkw" : "ccchunkw", coll_irregular_complex_chunk_write,NULL, "collective irregular complex chunk write",PARATESTFILE); AddTest((mpi_size > 3) ? "-ccchunkr" : "ccchunkr", coll_irregular_complex_chunk_read,NULL, "collective irregular complex chunk read",PARATESTFILE); #endif AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE); io_mode_confusion_params.name = PARATESTFILE; io_mode_confusion_params.count = 0; /* value not used */ AddTest("I/Omodeconf", io_mode_confusion, NULL, "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); /* Display testing information */ TestInfo(argv[0]); /* setup file access property list */ fapl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* Parse command line arguments */ TestParseCmdLine(argc, argv); if (facc_type == FACC_MPIPOSIX && MAINPROCESS) { printf("===================================\n" " Using MPIPOSIX driver\n" "===================================\n"); } if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) { printf("===================================\n" " Using Independent I/O with file set view to replace collective I/O \n" "===================================\n"); } /* Perform requested testing */ PerformTests(); /* make sure all processes are finished before final report, cleanup * and exit. */ MPI_Barrier(MPI_COMM_WORLD); /* Display test summary, if requested */ if (MAINPROCESS && GetTestSummary()) TestSummary(); /* Clean up test files */ h5_cleanup(FILENAME, fapl); nerrors += GetTestNumErrs(); /* Gather errors from all processes */ { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); nerrors=temp; } if (MAINPROCESS) { /* only process 0 reports */ printf("===================================\n"); if (nerrors) printf("***PHDF5 tests detected %d errors***\n", nerrors); else printf("PHDF5 tests finished with no errors\n"); printf("===================================\n"); } /* close HDF5 library */ H5close(); /* MPI_Finalize must be called AFTER H5close which may use MPI calls */ MPI_Finalize(); /* cannot just return (nerrors) because exit code is limited to 1byte */ return(nerrors!=0); }