Example #1
0
TEST( String, op_sub_eq, off )
{
    ex::string_t str1 ("Hello_World_This_is_Wu_Jie");
    ex::string_t str2 ("Hello World This is Wu Jie.");

    str1 -= "This";
    ex_log("str1 = %s\n", str1.c_str());
    CHECK( str1 == "Hello_World__is_Wu_Jie" );

    str2 -= "this";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == "Hello World This is Wu Jie." );

    str2 -= "Wu Jie";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == "Hello World This is ." );

    str2 -= "Hello";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == " World This is ." );

    str2 -= "This i";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == " World s ." );

    EX_HW_BREAK();
}
Example #2
0
File: memmng.c Project: exdev/exsdk
static void __dump () {
    //
    if ( ex_hashmap_count(&__au_map) > 0 ) {
        ex_log( "There are %d place(s) exsits memory leak.",  ex_hashmap_count(&__au_map) );
        EX_HW_BREAK();
    }
    
    //
    if ( ex_hashmap_count(&__au_map) ) {
        ex_hashmap_each ( &__au_map, alloc_unit_t *, au ) {
            char text[2048];
            ex_memzero ( text, 2048 );
            snprintf ( text, 2048, 
                       "%s:%d: error memory leak\r\n"
                       "function name:  %s\r\n"
                       "tag name:       %s\r\n"
                       "original addr:  %#.8lx\r\n"
                       "debug addr:     %#.8lx\r\n"
                       "original size:  %lu(%#.8lX)\r\n"
                       "debug size:     %lu(%#.8lX)\r\n"
                       "alloc nr:       %lu(%#.8lX)\r\n"
                       "thread ID:      %lu(%#.8lX)\r\n"
                       "\r\n"
                       ,au->file_name ,(int)au->line_nr 
                       ,au->func_name 
                       ,au->tag_name 
                       ,ex_ptr_to_addr(au->org_addr) 
                       ,ex_ptr_to_addr(au->dbg_addr) 
                       ,au->org_size, au->org_size 
                       ,au->dbg_size, au->dbg_size 
                       ,au->alloc_nr, au->alloc_nr 
                       ,au->thread_id, au->thread_id 
                     );

            // format log info
            ex_log( "%s", text ); 
            // DISABLE: use ex_log above instaed { 
            // __log ( "%s", text );
            // printf ( "%s", text ); // also show on the console.
            // } DISABLE end 

        } ex_hashmap_each_end;
    }
Example #3
0
TEST( String, op_sub, off )
{
    ex::string_t str ("Hello World This is Wu Jie.");
    ex::string_t result;

    result = str - "this";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == "Hello World This is Wu Jie." );

    result = str - "Wu Jie";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == "Hello World This is ." );

    result = str - "Hello";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == " World This is Wu Jie." );

    result = str - "This i";
    ex_log("result = %s\n", str.c_str());
    CHECK( result == "Hello World s Wu Jie." );

    EX_HW_BREAK();
}
Example #4
0
TEST( IFile, fileid, off )
{
    ex::uint64 fileID = -1;
    ex::IFile::smart_ptr_t spFile;
    ex::r_path_t xml_file( "res://xml/Array.xml" );
    if ( ex::futil::file::exists(xml_file.rawfile()) )
    {
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("first time get fileID = %d\n", fileID );

        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("second time get fileID = %d\n", fileID );

        spFile = ex::futil::file::readonly<ex::PhysicalFile> (xml_file.rawfile());
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("after readonly get fileID = %d\n", fileID );

        spFile = ex::futil::file::open<ex::PhysicalFile> (xml_file.rawfile());
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("after open exists get fileID = %d\n", fileID );

        EX_HW_BREAK();
    }
}