-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhello_world.cpp
More file actions
61 lines (50 loc) · 1.26 KB
/
Copy pathhello_world.cpp
File metadata and controls
61 lines (50 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "mock_non_virtual_p1.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <iostream>
#include <string>
#include <type_traits>
using namespace std;
using namespace ::testing;
template < class T >
struct TestSpecialization {
enum {
value = 0
};
};
template < typename T1, typename T2 >
struct TestSpecialization<is_same<T1, T2>> {
enum {
value = 1
};
};
struct TestStaticMember {
static string func() {
return "Non mocked.";
}
};
string func() {
return "Non mocked.";
}
#ifdef __APPLE__
TEST(HelloWorld, First) {
CreateMocker(mocker, func);
EXPECT_CALL(*mocker, MockFunction()).Times(Exactly(1))
.WillOnce(Return("Hello world."));
EXPECT_EQ("Hello world.", func());
cout << __cplusplus << endl;
}
TEST(HelloWorld, FunctionPointer) {
string (*pointer)();
pointer = &func;
CreateMocker(mocker, pointer);
EXPECT_CALL(*mocker, MockFunction()).Times(Exactly(1))
.WillOnce(Return("Hello world."));
EXPECT_EQ("Hello world.", pointer());
// cout << TestSpecialization<is_same<int, bool>>::value << endl;
// cout << TestSpecialization<int, bool>::value << endl;
}
TEST(HelloWorld, TestStaticMember) {
CreateMocker(mocker, TestStaticMember::func);
}
#endif