source: src/Helpers/unittests/AssertUnitTest.cpp@ 9e619e

Last change on this file since 9e619e was 9b8fa4, checked in by Frederik Heber <heber@…>, 14 years ago

Huge update of file structure to place installation header files into right folder.

  • The problem ist that we desire use as include "CodePatterns/...". For this to work, especially with the new Observer subfolder structure, it has been necessary to place all header files away from their source files into a distinct folder called CodePatterns. This emulates the later, after make install present structure.
  • essentially all source and header files had to be changed to adapt the include.
  • all Makefile.am's had to be changed.
  • nobase_ ... was removed such that header files are installed flat and not creating their subfolder along the process.
  • We placed Observer into its own convenience library and own folder Observer away from Patterns.

Some other changes:

  • FIX: MemDebug.hpp inclusion has been removed in all stubs.
  • Property mode set to 100644
File size: 1.5 KB
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
21using 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'
38CPPUNIT_TEST_SUITE_REGISTRATION( AssertTest );
39
40void testfunction() {
41 ASSERT(0==1, "testfunction() - 0 != 1");
42}
43
44void testfunction2() {
45 ASSERT(0==0, "testfunction() - 0 != 0");
46}
47
48void AssertTest::setUp()
49{
50 ASSERT_DO(Assert::Ignore);
51};
52
53void AssertTest::tearDown()
54{};
55
56/**
57 * UnitTest for execeptions thrown by ASSERT()
58 */
59void 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.