Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 6, 2015, 6:06:39 PM (9 years ago)
Author:
landauf
Message:

moved functor-tests to new file

Location:
code/branches/cpp11_v2/test/core
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/test/core/CMakeLists.txt

    r10822 r10922  
    2020    command/CommandTest.cc
    2121    command/FunctorPtrTest.cc
     22    command/FunctorTest.cc
    2223    command/ExecutorPtrTest.cc
    2324    object/ClassFactoryTest.cc
  • code/branches/cpp11_v2/test/core/command/FunctorPtrTest.cc

    r10865 r10922  
    2929                }
    3030        };
    31 
    32         void f1(int, double)
    33         {
    34         }
    35 
    36         void f2(int, double, double)
    37         {
    38         }
    39 
    40         int f3(int, double, double)
    41         {
    42             return 0;
    43         }
    4431    }
    4532
     
    9582        ASSERT_TRUE(static_cast<bool>(ptr2));
    9683    }
    97 
    98     TEST_F(FunctorPtrTest, canCompareHeaderIdentifiers)
    99     {
    100         FunctorPtr fp1 = createFunctor(&f1);
    101         FunctorPtr fp2 = createFunctor(&f2);
    102         FunctorPtr fp3 = createFunctor(&f3);
    103         ASSERT_TRUE(fp1->getHeaderIdentifier(1) == fp2->getHeaderIdentifier(1));
    104         ASSERT_TRUE(fp1->getHeaderIdentifier(2) == fp2->getHeaderIdentifier(2));
    105         ASSERT_FALSE(fp1->getHeaderIdentifier(1) == fp2->getHeaderIdentifier(2));
    106         ASSERT_FALSE(fp1->getHeaderIdentifier(10) == fp2->getHeaderIdentifier(10));
    107         ASSERT_FALSE(fp2->getHeaderIdentifier(2) == fp3->getHeaderIdentifier(2));
    108         ASSERT_FALSE(fp1->getHeaderIdentifier() == fp2->getHeaderIdentifier());
    109         ASSERT_FALSE(fp2->getHeaderIdentifier() == fp3->getHeaderIdentifier());
    110     }
    111 
    112     TEST_F(FunctorPtrTest, canCompareTypenames)
    113     {
    114         FunctorPtr fp1 = createFunctor(&f1);
    115         FunctorPtr fp2 = createFunctor(&f2);
    116         FunctorPtr fp3 = createFunctor(&f3);
    117         ASSERT_TRUE(fp1->getTypenameReturnvalue() == fp2->getTypenameReturnvalue());
    118         ASSERT_TRUE(fp1->getTypenameParam(0) == fp3->getTypenameParam(0));
    119         ASSERT_EQ("void", fp1->getTypenameReturnvalue());
    120         ASSERT_EQ("int", fp3->getTypenameReturnvalue());
    121         ASSERT_EQ("int", fp2->getTypenameParam(0));
    122         ASSERT_EQ("double", fp3->getTypenameParam(2));
    123         ASSERT_EQ("", fp3->getTypenameParam(6));
    124     }
    125 
    126     TEST_F(FunctorPtrTest, testGetParamCountAndHasReturnValue)
    127     {
    128         FunctorPtr fp1 = createFunctor(&f1);
    129         FunctorPtr fp2 = createFunctor(&f2);
    130         FunctorPtr fp3 = createFunctor(&f3);
    131         ASSERT_EQ(3, fp2->getParamCount());
    132         ASSERT_FALSE(fp1->getParamCount() == fp3->getParamCount());
    133         ASSERT_FALSE(fp2->hasReturnvalue());
    134         ASSERT_TRUE(fp3->hasReturnvalue());
    135     }
    136 
    137     TEST_F(FunctorPtrTest, canEvaluateArgument)
    138     {
    139         FunctorPtr fp1 = createFunctor(&f1);
    140         MultiType mttype = "2";
    141         fp1->evaluateArgument(0, mttype);
    142         ASSERT_TRUE(mttype.isType<int>());
    143         ASSERT_EQ(2, mttype.get<int>());
    144         fp1->evaluateArgument(1, mttype);
    145         ASSERT_TRUE(mttype.isType<double>());
    146         ASSERT_EQ(2.0, mttype.get<double>());
    147         mttype.reset();
    148         fp1->evaluateArgument(5, mttype);
    149         ASSERT_TRUE(mttype.null());
    150     }
    15184}
Note: See TracChangeset for help on using the changeset viewer.