Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 11, 2008, 12:25:11 AM (16 years ago)
Author:
rgrieder
Message:

test files, no real content.

Location:
code/branches/core3/src/orxonox
Files:
3 edited

Legend:

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

    r1658 r1766  
    7777#include "Settings.h"
    7878
     79#define TestConv(nr, Type1, var1, Type2, res) \
     80    Type1 var##nr##1##var1; \
     81    Type2 var##nr##2; \
     82    assert(ConvertValue(&var##nr##2, var##nr##1)); \
     83    COUT(0) << "Converting " << #var1 << " (" << #Type1 << ") to " << var##nr##2 << " (" #Type2 << ")." << std::endl; \
     84    assert(res == var##nr##2)
     85
     86template <>
     87struct ConverterExplicit<orxonox::Radian, const char*>
     88{
     89    static bool convert(orxonox::Radian* output, const char* input)
     90    {
     91        float temp;
     92        convertValue(&temp, input);
     93        *output = temp;
     94    }
     95};
     96
    7997
    8098// FIXME: is this really file scope?
     
    189207#endif
    190208    Factory::createClassHierarchy();
     209
     210    Radian nmbr;
     211    float res;
     212    //const char* nmbr;
     213    //const char* str;
     214    convertValue(&res, nmbr);
     215    //const unsigned int blah = 4;
     216    //convertValue(nmbr, blah);
     217    //convertValue(&str, 4.0f);
     218
     219
     220    using ::operator<<;
     221    using std::string;
     222    int a = 3;
     223    Radian asdf;
     224    COUT(3) << asdf;
     225
     226    TestConv(1, int, (3), float, 3.0);
     227    TestConv(2, int, (3), string, "3");
     228    TestConv(3, string, ("3.0"), float, 3.0f);
     229    TestConv(4, char, ('a'), string, "a");
     230    TestConv(5, string, ("df"), char, 'd');
     231    TestConv(6, Vector2, (3,4), string, "3,4");
     232    TestConv(7, const char*, ("4.3"), float, 4.3f);
     233    TestConv(8, const char*, ("4,3"), Vector2, Vector2(4,3));
     234    TestConv(9, const char*, ("4.4"), Radian, Radian(4.4));
     235    TestConv(100, int, (3), const char*, "3");
     236    TestConv(101, Vector3, (1, 2, 3), float, 3.0);
     237
     238    std::ostringstream out;
    191239
    192240    std::string mode;
  • code/branches/core3/src/orxonox/Orxonox.h

    r1563 r1766  
    3535#ifndef _Orxonox_H__
    3636#define _Orxonox_H__
     37inline bool explicitConversion(float* output, const double input)
     38{
     39    *output = 2*input;
     40    return true;
     41}
    3742
    3843#include "OrxonoxPrereqs.h"
  • code/branches/core3/src/orxonox/OrxonoxStableHeaders.h

    r1721 r1766  
    3535#define _OrxonoxStableHeaders_H__
    3636
    37 #include "util/OrxonoxPlatform.h"
     37#include "OrxonoxPrereqs.h"
    3838
    3939#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
Note: See TracChangeset for help on using the changeset viewer.