engine/ddf/src/test/test_ddf.cpp
// TODO: Disabled on iOS
// We have add functionality to located tmp-dir on iOS. See issue #624
Disabled on iOS
We have add functionality to located tmp-dir on iOS. See issue #624
Disabled on iOS We have add functionality to located tmp - dir on iOS . See issue #624
TEST(Simple, LoadFromFile)
{
    int32_t test_values[] = { INT32_MIN, INT32_MAX, 0 };
    for (uint32_t i = 0; i < sizeof(test_values)/sizeof(test_values[0]); ++i)
    {
        TestDDF::Simple simple;
        simple.set_a(test_values[i]);
        char path[512];
        const char* file_name = MakeHostPath(path, sizeof(path), "__TEMPFILE__");
        {
            std::fstream output(file_name,  std::ios::out | std::ios::trunc | std::ios::binary);
            ASSERT_EQ(true, simple.SerializeToOstream(&output));
        }
        void* message;
        dmDDF::Result e = dmDDF::LoadMessageFromFile(file_name, &DUMMY::TestDDF_Simple_DESCRIPTOR, &message);
        ASSERT_EQ(dmDDF::RESULT_OK, e);
        #ifdef _WIN32
        _unlink(file_name);
        #else
        unlink(file_name);
        #endif
        DUMMY::TestDDF::Simple* msg = (DUMMY::TestDDF::Simple*) message;
        ASSERT_EQ(simple.a(), msg->m_A);
        dmDDF::FreeMessage(message);
    }
}
TEST ( Simple , LoadFromFile ) { int32_t test_values [ ] = { INT32_MIN , INT32_MAX , 0 } ; for ( uint32_t i = 0 ; i < sizeof ( test_values ) / sizeof ( test_values [ 0 ] ) ; ++ i ) { TestDDF :: Simple simple ; simple . set_a ( test_values [ i ] ) ; char path [ 512 ] ; const char * file_name = MakeHostPath ( path , sizeof ( path ) , " " ) ; { std :: fstream output ( file_name , std :: ios :: out | std :: ios :: trunc | std :: ios :: binary ) ; ASSERT_EQ ( true , simple . SerializeToOstream ( & output ) ) ; } void * message ; dmDDF :: Result e = dmDDF :: LoadMessageFromFile ( file_name , & DUMMY :: TestDDF_Simple_DESCRIPTOR , & message ) ; ASSERT_EQ ( dmDDF :: RESULT_OK , e ) ; #ifdef _WIN32 _unlink ( file_name ) ; #else unlink ( file_name ) ; #endif DUMMY :: TestDDF :: Simple * msg = ( DUMMY :: TestDDF :: Simple * ) message ; ASSERT_EQ ( simple . a ( ) , msg -> m_A ) ; dmDDF :: FreeMessage ( message ) ; } }
TODO: Disabled on iOS
We have add functionality to located tmp-dir on iOS.
TODO : Disabled on iOS We have add functionality to located tmp - dir on iOS .