Statistics
| Revision:

root / trunk / tests / gtests / test_ad_comm.cpp @ 1157

History | View | Annotate | Download (910 Bytes)

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
}