Revision 1157

trunk/tests/gtests/Makefile (revision 1157)
3 3
all: gtest-all
4 4
	./gtest-all
5 5

  
6
gtest-all: main.cpp test_adstring_strcase.cpp test_fmm_control.cpp test_atan2.cpp test_adstring_array.cpp
6
gtest-all: main.cpp test_adstring_strcase.cpp test_fmm_control.cpp test_atan2.cpp test_adstring_array.cpp test_dlist.cpp test_ad_comm.cpp
7 7
	cp $(GTEST_DIR)/gtest-all.o .
8 8
	CXXFLAGS=-I$(GTEST_DIR)/include ../../admb gtest-all.o $^
9 9

  
trunk/tests/gtests/test_ad_comm.cpp (revision 1157)
1
#include <gtest/gtest.h>
2
#include <fvar.hpp>
3
#include <cmath>
4

  
5
class test_ad_comm: public ::testing::Test {};
6

  
7
class ad_comm2: public ad_comm
8
{
9
public:
10
ad_comm2(int argc, char *argv[]): ad_comm(argc, argv)
11
{
12
}
13
};
14

  
15
TEST_F(test_ad_comm, constructor)
16
{
17
  int argc = 3;
18
  char* argv[] = { "./simple" , "-ind", "other.dat"};
19
  ad_comm2 adcomm(argc, argv);
20
}
21
TEST_F(test_ad_comm, option_match_ind)
22
{
23
  int argc = 7;
24
  char* argv[] = {"./dogsbmDIC", "-ind", "dog4s.ctl", "-ainp", "dog4p.pin", "-nox", "-est"};
25
  int opt = option_match(argc, argv, "-ind");
26
  EXPECT_EQ(1, opt);
27
}
28
TEST_F(test_ad_comm, option_match_ind_option_with_unicode_char)
29
{
30
  int argc = 3;
31
  //the '-' is a unicode char
32
  char* argv[] = {"./dogsbmDIC", "–ind", "dog4s.ctl"};
33
  EXPECT_EQ('\xE2', argv[1][0]);
34
  EXPECT_EQ('\x80', argv[1][1]);
35
  EXPECT_EQ('\x93', argv[1][2]);
36
  int opt = option_match(argc, argv, "-ind");
37
  EXPECT_EQ(-1, opt);
38
}
trunk/tests/gtests/test_dlist.cpp (revision 1157)
1
#include <gtest/gtest.h>
2
#include <fvar.hpp>
3

  
4
extern char* ddlist_space;
5

  
6
class test_dlist: public ::testing::Test {};
7

  
8
TEST_F(test_dlist, constructor)
9
{
10
  dlist lst;
11
  EXPECT_STRNE(0, ddlist_space);
12
}
13
TEST_F(test_dlist, destructor)
14
{
15
  dlist* lst = new dlist();
16
  delete lst;
17
  lst = 0;
18

  
19
  EXPECT_EQ(0, ddlist_space);
20
}
21
TEST_F(test_dlist, last_remove_empty_list)
22
{
23
  dlist lst;
24
  EXPECT_EQ(0, lst.last_remove());
25
}
26
TEST_F(test_dlist, create)
27
{
28
  dlist lst;
29

  
30
  //EXPECT_EQ(sizeof(double) * 2, sizeof(dlink));
31

  
32
  dlink* a = lst.create();
33
  //EXPECT_EQ((intptr_t)ddlist_space + (0 * sizeof(double)), (intptr_t)a);
34
  EXPECT_EQ((intptr_t)ddlist_space + (0 * sizeof(dlink)), (intptr_t)a);
35
  EXPECT_EQ(0, (intptr_t)a->previous());
36

  
37
  dlink* b = lst.create();
38
  //EXPECT_EQ((intptr_t)ddlist_space + (2 * sizeof(double)), (intptr_t)b);
39
  EXPECT_EQ((intptr_t)ddlist_space + (1 * sizeof(dlink)), (intptr_t)b);
40
  EXPECT_EQ(0, (intptr_t)b->previous());
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff