FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
test_Database.cpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <fei_macros.hpp>
10 #include <fei_mpi.h>
11 #include <test_utils/test_Database.hpp>
12 #include <snl_fei_Utils.hpp>
13 #include <snl_fei_MapContig.hpp>
14 
15 #undef fei_file
16 #define fei_file "test_Database.cpp"
17 
18 #include <fei_ErrMacros.hpp>
19 
20 test_Database::test_Database(MPI_Comm comm)
21  : tester(comm)
22 {
23 }
24 
25 test_Database::~test_Database()
26 {
27 }
28 
29 void test_MapContig_1()
30 {
31  FEI_COUT << "testing snl_fei::MapContig...";
32 
33  snl_fei::MapContig<int> mc(0, 3);
34 
35  std::pair<snl_fei::MapContig<int>::iterator,bool> mpair = mc.insert(std::pair<int,int>(1, 2));
36 
37  snl_fei::MapContig<int>::iterator miter = mpair.first;
38 
39  if ((*miter).second != 2) {
40  throw std::runtime_error("MapContig insert iter test 1 failed.");
41  }
42 
43  mc.insert(std::pair<int,int>(0,1));
44 
46  m_iter = mc.begin(),
47  m_end = mc.end();
48 
49  if ((*m_iter).first != 0) {
50  throw std::runtime_error("MapContig iter test 1 failed.");
51  }
52 
53  if ((*m_iter).second != 1) {
54  throw std::runtime_error("MapContig iter test 2 failed.");
55  }
56 
57  ++m_iter;
58 
59  if ((*m_iter).first != 1) {
60  throw std::runtime_error("MapContig iter test 3 failed.");
61  }
62 
63  if ((*m_iter).second != 2) {
64  throw std::runtime_error("MapContig iter test 4 failed.");
65  }
66 
67  FEI_COUT << "ok"<<FEI_ENDL;
68 }
69 
70 int test_Database::runtests()
71 {
72  if (numProcs_ > 1) return(0);
73 
74  test_MapContig_1();
75 
76  CHK_ERR( test1() );
77  CHK_ERR( test2() );
78  CHK_ERR( test3() );
79  CHK_ERR( test4() );
80  CHK_ERR( test5() );
81  CHK_ERR( test6() );
82  CHK_ERR( test7() );
83  CHK_ERR( test8() );
84 
85  return(0);
86 }
87 
88 int test_Database::test1()
89 {
90  return(0);
91 }
92 
93 int test_Database::test2()
94 {
95  return(0);
96 }
97 
98 int test_Database::test3()
99 {
100  return(0);
101 }
102 
103 int test_Database::test4()
104 {
105 
106  return(0);
107 }
108 
109 int test_Database::test5()
110 {
111 
112  return(0);
113 }
114 
115 int test_Database::test6()
116 {
117 
118  return(0);
119 }
120 
121 int test_Database::test7()
122 {
123 
124  return(0);
125 }
126 
127 int test_Database::test8()
128 {
129 
130  return(0);
131 }