Action_Thermostats
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
AutomationFragmentation_failures
Candidate_v1.6.1
ChemicalSpaceEvaluator
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Exclude_Hydrogens_annealWithBondGraph
Fix_Verbose_Codepatterns
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
Gui_displays_atomic_force_velocity
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
PythonUI_with_named_parameters
Recreated_GuiChecks
StoppableMakroAction
TremoloParser_IncreasedPrecision
Line | |
---|
1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * AssertUnitTest.cpp
|
---|
10 | *
|
---|
11 | * Created on: Feb 10, 2011
|
---|
12 | * Author: heber
|
---|
13 | */
|
---|
14 |
|
---|
15 |
|
---|
16 | // include config.h
|
---|
17 | #ifdef HAVE_CONFIG_H
|
---|
18 | #include <config.h>
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | using namespace std;
|
---|
22 |
|
---|
23 | #include <cppunit/CompilerOutputter.h>
|
---|
24 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
25 | #include <cppunit/ui/text/TestRunner.h>
|
---|
26 |
|
---|
27 | #include "CodePatterns/Assert.hpp"
|
---|
28 |
|
---|
29 | #include "AssertUnitTest.hpp"
|
---|
30 |
|
---|
31 | #ifdef HAVE_TESTRUNNER
|
---|
32 | #include "UnitTestMain.hpp"
|
---|
33 | #endif /*HAVE_TESTRUNNER*/
|
---|
34 |
|
---|
35 | /********************************************** Test classes **************************************/
|
---|
36 |
|
---|
37 | // Registers the fixture into the 'registry'
|
---|
38 | CPPUNIT_TEST_SUITE_REGISTRATION( AssertTest );
|
---|
39 |
|
---|
40 | void testfunction() {
|
---|
41 | ASSERT(0==1, "testfunction() - 0 != 1");
|
---|
42 | }
|
---|
43 |
|
---|
44 | void testfunction2() {
|
---|
45 | ASSERT(0==0, "testfunction() - 0 != 0");
|
---|
46 | }
|
---|
47 |
|
---|
48 | void AssertTest::setUp()
|
---|
49 | {
|
---|
50 | ASSERT_DO(Assert::Ignore);
|
---|
51 | };
|
---|
52 |
|
---|
53 | void AssertTest::tearDown()
|
---|
54 | {};
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * UnitTest for execeptions thrown by ASSERT()
|
---|
58 | */
|
---|
59 | void AssertTest::ThrowTest()
|
---|
60 | {
|
---|
61 | // test throw
|
---|
62 | ASSERT_DO(Assert::Throw);
|
---|
63 | CPPUNIT_ASSERT_THROW(testfunction(), Assert::AssertionFailure);
|
---|
64 | CPPUNIT_ASSERT_NO_THROW(testfunction2());
|
---|
65 | // test no throws on ignore (abort and others would interrupt unit test)
|
---|
66 | ASSERT_DO(Assert::Ignore);
|
---|
67 | CPPUNIT_ASSERT_NO_THROW(testfunction());
|
---|
68 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.