[c52abd] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
| 5 | * Copyright (C) 2013 Frederik Heber. All rights reserved.
|
---|
| 6 | *
|
---|
| 7 | *
|
---|
| 8 | * This file is part of MoleCuilder.
|
---|
| 9 | *
|
---|
| 10 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 11 | * it under the terms of the GNU General Public License as published by
|
---|
| 12 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 13 | * (at your option) any later version.
|
---|
| 14 | *
|
---|
| 15 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 18 | * GNU General Public License for more details.
|
---|
| 19 | *
|
---|
| 20 | * You should have received a copy of the GNU General Public License
|
---|
| 21 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 22 | */
|
---|
| 23 |
|
---|
| 24 | /*
|
---|
| 25 | * Graph6ReaderUnitTest.cpp
|
---|
| 26 | *
|
---|
| 27 | * Created on: Oct 17, 2011
|
---|
| 28 | * Author: heber
|
---|
| 29 | */
|
---|
| 30 |
|
---|
| 31 | // include config.h
|
---|
| 32 | #ifdef HAVE_CONFIG_H
|
---|
| 33 | #include <config.h>
|
---|
| 34 | #endif
|
---|
| 35 |
|
---|
| 36 | #include "Graph6ReaderUnitTest.hpp"
|
---|
| 37 |
|
---|
| 38 | #include <iterator>
|
---|
| 39 | #include <sstream>
|
---|
| 40 |
|
---|
| 41 | #include "CodePatterns/Assert.hpp"
|
---|
| 42 |
|
---|
| 43 | #include <cppunit/CompilerOutputter.h>
|
---|
| 44 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
| 45 | #include <cppunit/ui/text/TestRunner.h>
|
---|
| 46 |
|
---|
| 47 | #ifdef HAVE_TESTRUNNER
|
---|
| 48 | #include "UnitTestMain.hpp"
|
---|
| 49 | #endif /*HAVE_TESTRUNNER*/
|
---|
| 50 |
|
---|
| 51 | /********************************************** Test classes **************************************/
|
---|
| 52 | // Registers the fixture into the 'registry'
|
---|
| 53 | CPPUNIT_TEST_SUITE_REGISTRATION( Graph6ReaderTest );
|
---|
| 54 |
|
---|
| 55 | const std::string graph6file ="B`";
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | // set up and tear down
|
---|
| 59 | void Graph6ReaderTest::setUp()
|
---|
| 60 | {
|
---|
| 61 | // failing asserts should be thrown
|
---|
| 62 | ASSERT_DO(Assert::Throw);
|
---|
| 63 |
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | void Graph6ReaderTest::tearDown()
|
---|
| 67 | {
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | /** Unit tests for Graph6Reader::operator().
|
---|
| 71 | *
|
---|
| 72 | */
|
---|
| 73 | void Graph6ReaderTest::operatorTest()
|
---|
| 74 | {
|
---|
| 75 | // parse in graph6 string
|
---|
| 76 | std::stringstream input(graph6file);
|
---|
| 77 | reader(input);
|
---|
| 78 |
|
---|
| 79 | // compare nodes
|
---|
| 80 | CPPUNIT_ASSERT_EQUAL( reader.get_num_nodes(), (int)2);
|
---|
| 81 |
|
---|
| 82 | // compare edges
|
---|
| 83 | CPPUNIT_ASSERT_EQUAL( reader.get_edges().size(), (size_t)1);
|
---|
| 84 | }
|
---|