Revision 1176 branches/threaded2merge/tests/threads/msimple/tests_msimple.cpp

tests_msimple.cpp (revision 1176)
6 6
#define main msimple_main
7 7
#include "msimple.cpp"
8 8

  
9
extern "C" {
10
  void test_ad_boundf(int i)
11
  {
12
    throw i;
13
  }
14
}
15

  
9 16
TEST_F(tests_msimple, msimple_main)
10 17
{
11 18
  int argc = 1;
12 19
  char* argv[] = {"msimple"};
13 20
  msimple_main(argc, argv);
14 21
}
22
TEST_F(tests_msimple, msimple_main_test_for_cleanups_files)
23
{
24
  int argc = 1;
25
  char* argv[] = {"msimple"};
26
  msimple_main(argc, argv);
27
  msimple_main(argc, argv);
28
}
29
TEST_F(tests_msimple, msimple_main_contents)
30
{
31
  int argc = 1;
32
  char* argv[] = {"msimple"};
33
  //msimple_main(argc, argv);
34
  ad_set_new_handler();
35
  ad_exit=&test_ad_boundf;
36
  gradient_structure::set_NO_DERIVATIVES();
37
  gradient_structure::set_YES_SAVE_VARIABLES_VALUES();
38
  if (!arrmblsize) arrmblsize=15000000;
39
  try
40
  {
41
    model_parameters mp(arrmblsize,argc,argv);
42
    mp.iprint=10;
43
    mp.preliminary_calculations();
44
    mp.computations(argc,argv);
45
  } 
46
  catch (int i)
47
  {
48
    FAIL();
49
  }
50
}
51
TEST_F(tests_msimple, msimple_main_model_parameters)
52
{
53
  int argc = 1;
54
  char* argv[] = {"msimple"};
55
  ad_set_new_handler();
56
  ad_exit=&test_ad_boundf;
57
  gradient_structure::set_NO_DERIVATIVES();
58
  gradient_structure::set_YES_SAVE_VARIABLES_VALUES();
59
  if (!arrmblsize) arrmblsize=15000000;
60
  try
61
  {
62
    model_parameters mp(arrmblsize,argc,argv);
63
  } 
64
  catch (int i)
65
  {
66
    FAIL();
67
  }
68
}
69
class test_named_dvar_vector: public named_dvar_vector 
70
{ 
71
public:
72
  void allocate()
73
  {
74
    int nthread = 1;
75
    named_dvar_vector::allocate(1, nthread, "ff");
76
  }
77
};
78
TEST_F(tests_msimple, msimple_param_vector_nogradient_structure_in_scope)
79
{
80
  test_named_dvar_vector ff;
81
  try
82
  {
83
    ff.allocate();
84
  } 
85
  catch (int i)
86
  {
87
    //Expect exception
88
    return;
89
  }
90
  FAIL();
91
}
92
class test_ad_comm: public ad_comm
93
{ 
94
public:
95
  test_ad_comm(int argc, char* argv[]): ad_comm(argc, argv)
96
  {
97
  }
98
};
99
TEST_F(tests_msimple, msimple_param_vector)
100
{
101
  gradient_structure gs(150000L);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff