Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 26, 2008, 12:35:58 AM (16 years ago)
Author:
rgrieder
Message:

Added convert test for gcc.

Location:
code/branches/core3/src/orxonox
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/orxonox/Orxonox.cc

    r1778 r2014  
    231231    Factory::createClassHierarchy();
    232232
    233     std::string nmbr;
    234     char res('a');
    235     //const char* nmbr;
    236     //const char* str;
    237     convertValue(&nmbr, res);
    238     //const unsigned int blah = 4;
    239     //convertValue(nmbr, blah);
    240     //convertValue(&str, 4.0f);
    241 
    242     //using ::operator<<;
    243     using std::string;
    244     int a = 3;
    245     FooBar asdf;
    246     std::string asdf2;
    247     std::ostringstream oss;
    248     char blah(' ');
    249     oss << blah;
    250     std::cout << asdf2;
    251     ConvertValue(&asdf2, asdf);
    252     //if (conversionTests::OStreamOperator<FooBar>::exists)
    253     //    int asdfasdfasdf = 7;
    254     //COUT(3) << asdf;
    255 
    256     TestConv(1, int, (3), float, 3.0);
    257     TestConv(2, int, (3), string, "3");
    258     TestConv(3, string, ("3.0"), float, 3.0f);
    259     TestConv(4, char, ('a'), string, "a");
    260     TestConv(5, string, ("df"), char, 'd');
    261     TestConv(6, Vector2, (3,4), string, "3,4");
    262     TestConv(7, const char*, ("4.3"), float, 4.3f);
    263     TestConv(8, const char*, ("4,3"), Vector2, Vector2(4,3));
    264     //TestConv(9, const char*, ("4.4"), Radian, Radian(4.4));
    265     TestConv(100, int, (3), const char*, "3");
    266     TestConv(101, Vector3, (1, 2, 3), float, 3.0);
    267 
    268     std::ostringstream out;
     233#include "convert_test.cc"
     234
     235    // some special string conversions
     236    const char* myCString = "84.0";
     237    COUT(0) << conversion_cast<std::string>(myCString) << std::endl;
     238    COUT(0) << conversion_cast<float>(myCString) << std::endl;
     239    COUT(0) << conversion_cast<Vector2>(myCString) << std::endl;
     240    COUT(0) << conversion_cast<std::string>(conversion_cast<Radian>(myCString)) << std::endl;
     241    COUT(0) << std::endl;
     242
     243    std::string myString = "3,4,1";
     244    COUT(0) << conversion_cast<Vector3>(myString) << std::endl;
     245   
     246
     247    //std::string nmbr;
     248    //char res('a');
     249    ////const char* nmbr;
     250    ////const char* str;
     251    //convertValue(&nmbr, res);
     252    ////const unsigned int blah = 4;
     253    ////convertValue(nmbr, blah);
     254    ////convertValue(&str, 4.0f);
     255
     256    ////using ::operator<<;
     257    //using std::string;
     258    //int a = 3;
     259    //FooBar asdf;
     260    //std::string asdf2;
     261    //std::ostringstream oss;
     262    //char blah(' ');
     263    //oss << blah;
     264    //std::cout << asdf2;
     265    //ConvertValue(&asdf2, asdf);
     266    ////if (conversionTests::OStreamOperator<FooBar>::exists)
     267    ////    int asdfasdfasdf = 7;
     268    ////COUT(3) << asdf;
     269
     270    //TestConv(1, int, (3), float, 3.0);
     271    //TestConv(2, int, (3), string, "3");
     272    //TestConv(3, string, ("3.0"), float, 3.0f);
     273    //TestConv(4, char, ('a'), string, "a");
     274    //TestConv(5, string, ("df"), char, 'd');
     275    //TestConv(6, Vector2, (3,4), string, "3,4");
     276    //TestConv(7, const char*, ("4.3"), float, 4.3f);
     277    //TestConv(8, const char*, ("4,3"), Vector2, Vector2(4,3));
     278    ////TestConv(9, const char*, ("4.4"), Radian, Radian(4.4));
     279    //TestConv(100, int, (3), const char*, "3");
     280    //TestConv(101, Vector3, (1, 2, 3), float, 3.0);
     281
     282    //std::ostringstream out;
    269283
    270284    std::string mode;
Note: See TracChangeset for help on using the changeset viewer.