[go: up one dir, main page]

File: StandardTests.cpp

package info (click to toggle)
coin3 3.1.3-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 48,344 kB
  • ctags: 70,042
  • sloc: cpp: 314,328; ansic: 15,927; sh: 13,635; makefile: 8,780; perl: 2,149; lex: 1,302; lisp: 1,247; yacc: 184; xml: 175; sed: 68
file content (63 lines) | stat: -rw-r--r-- 1,936 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#define BOOST_TEST_NO_LIB 1
#include <boost/test/unit_test.hpp>

#include <boost/filesystem.hpp>   // includes all needed Boost.Filesystem declarations
#include <iostream>               // for std::cout
using namespace boost::filesystem;          // for ease of tutorial presentation;
                                  //  a namespace alias is preferred practice in real code
#include <assert.h>
#include <stdio.h>
#include <iostream>

#include <Inventor/nodes/SoNode.h>

#include <TestSuiteUtils.h>
#include <TestSuiteMisc.h>


using namespace SIM::Coin3D::Coin;


static bool
testCorrectFile(SoNode * root, std::string & filename) {
  BOOST_CHECK_MESSAGE(root != NULL, (std::string("failed to read file ") + filename).c_str() );
  return root!=NULL;
}

static bool
testInCorrectFile(SoNode * root, std::string & filename) {
  BOOST_CHECK_MESSAGE(root == NULL, (std::string("Managed to read an incorrect file ") + filename).c_str() );
  return root!=NULL;
}

static bool
testOutOfSpecFile(SoNode * root, std::string & filename) {
  BOOST_CHECK_MESSAGE(root != NULL, (std::string("This out of spec file could be read in an earlier version ") + filename).c_str() );
  return root!=NULL;
}


namespace {
  const char * standardSuffixes_initializer [] = { ".wrl", "wrml", "wrl.gz", "wrml.gz", ".iv" };
  static std::vector<std::string> standardSuffixes(standardSuffixes_initializer,&standardSuffixes_initializer[sizeof(standardSuffixes_initializer)/sizeof(standardSuffixes_initializer[0])]);
}


BOOST_AUTO_TEST_SUITE(StandardTests);

BOOST_AUTO_TEST_CASE(loadCorrectfiles)
{
  TestSuite::test_all_files("models",standardSuffixes,&testCorrectFile);
}

BOOST_AUTO_TEST_CASE(loadIncorrectfiles)
{
  TestSuite::test_all_files("killers",standardSuffixes,&testInCorrectFile);
}

BOOST_AUTO_TEST_CASE(loadOutOfSpecFilesWhichWeAccept)
{
  TestSuite::test_all_files("slackers",standardSuffixes,&testOutOfSpecFile);
}

BOOST_AUTO_TEST_SUITE_END();