ForceAnnealing_goodresults
ForceAnnealing_tocheck
Rev | Line | |
---|
[084729c] | 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.