1 #include <gtest/gtest.h>
2 #include <gmock/gmock.h>
4 #include <ModelHighAPI_Double.h>
6 #include <MockModelAPI_AttributeDouble.h>
9 using ::testing::Return;
10 using ::testing::ReturnRefOfCopy;
11 using ::testing::Test;
13 // TODO(spo): should be common function
14 static void null_deleter(void *) {}
16 class HighModelAPI_Double_Test : public Test {
18 MockModelAPI_AttributeDouble aMockAttributeDouble;
19 std::shared_ptr<ModelAPI_AttributeDouble> anAttributeDouble;
21 HighModelAPI_Double_Test() {
22 anAttributeDouble = std::shared_ptr<ModelAPI_AttributeDouble>(&aMockAttributeDouble, &null_deleter);
25 ~HighModelAPI_Double_Test() {
29 TEST_F(HighModelAPI_Double_Test, Default) {
30 ModelHighAPI_Double aValue;
32 EXPECT_CALL(aMockAttributeDouble, setValue(0.));
34 aValue.fillAttribute(anAttributeDouble);
37 TEST_F(HighModelAPI_Double_Test, Double) {
38 ModelHighAPI_Double aValue(100.5);
40 EXPECT_CALL(aMockAttributeDouble, setValue(100.5));
42 aValue.fillAttribute(anAttributeDouble);
45 TEST_F(HighModelAPI_Double_Test, Char) {
46 ModelHighAPI_Double aValue("20");
48 EXPECT_CALL(aMockAttributeDouble, setText("20"));
50 aValue.fillAttribute(anAttributeDouble);
53 TEST_F(HighModelAPI_Double_Test, String) {
54 ModelHighAPI_Double aValue(std::string("x + 30"));
56 EXPECT_CALL(aMockAttributeDouble, setText("x + 30"));
58 aValue.fillAttribute(anAttributeDouble);