Revision 1305 trunk/tests/gtests/test_df_file.cpp

test_df_file.cpp (revision 1305)
1 1
#include <gtest/gtest.h>
2 2
#include <fvar.hpp>
3
#include <new>
4
//using std::new;
3 5

  
4 6
class test_df_file:public ::testing::Test {};
5 7

  
......
13 15

  
14 16
  ASSERT_EQ(-x, z);
15 17
}
16
/*
17 18
TEST_F(test_df_file, strtok)
18 19
{
19 20
  char args[100];
20
  strcpy(args, "afdk dkfjdk dkfjkdj kdsjfk dkjfkj\0");
21
  cout << args << endl;
22
  char* ca2 = strtok(args, " ");
23
  cout << "\"" << ca2 << "\"" << endl;
24
  char* ca3 = strtok(NULL, " ");
25
  cout << "\"" << ca3 << "\"" << endl;
26
  char* ca4 = strtok('\0', " ");
27
  cout << "\"" << ca4 << "\"" << endl;
28
  //char* ca5 = strtok((char*)"\0", " ");
29
  //cout << "\"" << ca5 << "\"" << endl;
21
  strcpy(args, "aaaa bbbb cccc dddd eeee ffff gggg\0");
22
  ASSERT_STREQ("aaaa", strtok(args, " "));
23
  ASSERT_STREQ("bbbb", strtok(NULL, " "));
24
  ASSERT_STREQ("cccc", strtok('\0', " "));
25
  //Does not work -> strtok((char*)"\0", " ")
30 26
}
31
*/
32
TEST_F(test_df_file, allocate_UULONG_MAX)
27
TEST_F(test_df_file, allocate_INT_MAX)
33 28
{
34
  unsigned long long int size = ULLONG_MAX;
35
  ASSERT_EQ(ULLONG_MAX, size);
36
  char* array = 0;
37
  ASSERT_NO_THROW(array = new char[size]);
38
  delete [] array;
39
  array = 0;
29
  int size = INT_MAX;
30
  ASSERT_EQ(INT_MAX, size);
31
  char* a = 0;
32
  ASSERT_NO_THROW(a = new char[size]);
33
  delete [] a;
34
  a = 0;
40 35
}
41
TEST_F(test_df_file, instance_LONG_MAX)
36
TEST_F(test_df_file, instance_INT_MAX)
42 37
{
43
  DF_FILE dffile;
44
  dffile.buff = new char[LONG_MAX];
38
  ASSERT_NO_THROW(DF_FILE instance(INT_MAX));
45 39
}
46
/*
47
TEST_F(test_df_file, instance_LLONG_MAX)
40
TEST_F(test_df_file, allocate_INT_MAX_plus_1)
48 41
{
49
  ASSERT_NO_THROW(DF_FILE df_file(LLONG_MAX));
42
  ASSERT_LT(INT_MAX, LONG_MAX);
43
  ASSERT_LT(LONG_MAX, SIZE_MAX);
44
  ASSERT_EQ(SIZE_MAX, ULONG_MAX);
45
  size_t size = INT_MAX + 1;
46
  ASSERT_LT(size, SIZE_MAX);
47
  char* a = new char[size];
48
  if (a != 0)
49
  {
50
    delete [] a;
51
    a = 0;
52
  }
50 53
}
51
TEST_F(test_df_file, instance_ULLONG_MAX)
52
{
53
  ASSERT_NO_THROW(DF_FILE df_file(ULLONG_MAX));
54
}
55
*/

Also available in: Unified diff