コード例 #1
0
TEST_F( OpenDDLExportTest, writeIntegerTest ) {
    OpenDDLExportMock myExport;
    Value *v = ValueAllocator::allocPrimData( Value::ddl_int8 );
    v->setInt8( 10 );
    bool ok( true );
    std::string statement;
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "10", statement );
    ValueAllocator::releasePrimData( &v );

    statement.clear();
    v = ValueAllocator::allocPrimData( Value::ddl_int16 );
    v->setInt16( 655 );
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "655", statement );
    ValueAllocator::releasePrimData( &v );

    statement.clear();
    v = ValueAllocator::allocPrimData( Value::ddl_int32 );
    v->setInt32( 65501 );
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "65501", statement );
    ValueAllocator::releasePrimData( &v );

    statement.clear();
    v = ValueAllocator::allocPrimData( Value::ddl_int64 );
    v->setInt64( 65502 );
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "65502", statement );
    ValueAllocator::releasePrimData( &v );
}
コード例 #2
0
TEST_F( OpenDDLExportTest, writeBoolTest ) {
    OpenDDLExportMock myExport;
    Value *v = ValueAllocator::allocPrimData( Value::ddl_bool );
    v->setBool( true );

    std::string statement;
    bool ok( true );
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "true", statement );

    v->setBool( false );
    statement.clear();
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "false", statement );

    ValueAllocator::releasePrimData( &v );
}
コード例 #3
0
TEST_F( OpenDDLExportTest, writeFloatTest ) {
    OpenDDLExportMock myExport;
    Value *v = ValueAllocator::allocPrimData( Value::ddl_float );
    v->setFloat( 1.1f );
    bool ok( true );
    std::string statement;
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "1.1", statement );
    ValueAllocator::releasePrimData( &v );
}
コード例 #4
0
TEST_F( OpenDDLExportTest, writeStringTest ) {
    OpenDDLExportMock myExport;
    Value *v = ValueAllocator::allocPrimData( Value::ddl_string );
    v->setString( "huhu" );
    bool ok( true );
    std::string statement;
    ok = myExport.writeValueTester( v, statement );
    EXPECT_TRUE( ok );
    EXPECT_EQ( "\"huhu\"", statement );
    ValueAllocator::releasePrimData( &v );
}