Revision 617

branches/big-buffers-test_smartlist/Makefile (revision 617)
1
default: linux
2
	
1 3
mingw:
2 4
	$(MAKE) --directory=src --file=mingw.mak
3 5

  
......
35 37
icc-verify:
36 38
	$(MAKE) --directory=src --file=linux.mak CC=icc CXX=icpc verify
37 39

  
38
linux: linux-admb linux-contrib
40
linux: linux-admb linux-contrib tests
39 41

  
40 42
linux-admb:
41 43
	$(MAKE) --directory=src --file=linux.mak
branches/big-buffers-test_smartlist/test/test_smartlist-biggerbuffer/tests_biggerbuffer.cpp (revision 617)
1
#include <fstream>
2
#include <limits.h>
3
#include <fcntl.h>
4
#include <gtest/gtest.h>
5
#include <exception>
6
#include <cstdlib>
7
#include <algorithm>
8
using std::fstream;
9
#include <df1b2fun.h>
10

  
11
const int argc = 3;
12
const char *argv[3] = {"binomial", "-l1", "1000003"};
13

  
14
class tests_test_smartlist: public ::testing::Test
15
{
16
public:
17
  tests_test_smartlist() {}
18
  virtual ~tests_test_smartlist() {}
19
  virtual void SetUp() {}
20
  virtual void TearDown() {}
21
};
22

  
23
#define main main_binomial
24
#include "binomial.cpp"
25
#undef main
26

  
27
TEST(test_smartlist, main)
28
{
29
  main_binomial(argc, argv);
30
}
31
TEST(test_smartlist, atoi)
32
{
33
  std::ostringstream oss;
34
  oss << INT_MAX;
35
  int i = std::atoi(oss.str().c_str());
36
  EXPECT_EQ(INT_MAX, i);
37
}
38
TEST(test_smartlist, atoiwithlargeint)
39
{
40
  long long expected = INT_MAX;
41
  expected++;
42
  std::ostringstream oss;
43
  oss << expected;
44
  int i = std::atoi(oss.str().c_str());
45
  EXPECT_NE(expected, i);
46
}
47
TEST(test_smartlist, bigcppwrite)
48
{
49
  fstream fp;
50

  
51
  fp.open("test.txt", fstream::in | fstream::out | fstream::binary | fstream::trunc);
52

  
53
  long long nbytes = INT_MAX;
54
  nbytes++;
55

  
56
  char* buffer = new char[nbytes];
57

  
58
  ASSERT_NO_THROW(fp.write(buffer, nbytes));
59

  
60
  delete buffer;
61
  buffer = 0;
62

  
63
  fp.close();
64

  
65
  unlink("test.txt");
66
}
67
TEST(test_smartlist, bigcwrite)
68
{
69
  int fp = open("test.txt", O_RDWR | O_CREAT | O_TRUNC | O_BINARY, S_IREAD | S_IWRITE);
70

  
71
  long long expected = INT_MAX;
72
  expected++;
73

  
74
  char* buffer = new char[expected];
75
  long long got = write(fp, buffer, expected);
76
  EXPECT_NE(got, expected);
77

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff