String& String::replace( iterator i, iterator j, String const &s ) { THIS_STRING->replace( i, j, *STRING_OF( s ) ); return *this; }
String::String( String const &s ) { new( THIS_STRING ) string_type( *STRING_OF( s ) ); }
ostream& operator<<( ostream &os, String const &s ) { return os << *STRING_OF( s ); }
String& String::operator=( String const &s ) { *THIS_STRING = *STRING_OF( s ); return *this; }
bool operator<=( string const &s1, String const &s2 ) { return s1 <= *STRING_OF( s2 ); }
String operator+( String const &s1, string const &s2 ) { string_type const s( *STRING_OF( s1 ) + s2 ); String::zstring_ptr const zp = { &s }; return String( zp ); }
int String::compare( size_type pos, size_type n, String const &s, size_type s_pos, size_type s_n ) const { return THIS_STRING->compare( pos, n, *STRING_OF( s ), s_pos, s_n ); }
bool operator<=( String const &s1, string const &s2 ) { return *STRING_OF( s1 ) <= s2; }
String& String::assign( String const &s, size_type pos, size_type n ) { THIS_STRING->assign( *STRING_OF( s ), pos, n ); return *this; }
int String::compare( String const &s ) const { return THIS_STRING->compare( *STRING_OF( s ) ); }
String& String::assign( String const &s ) { THIS_STRING->assign( *STRING_OF( s ) ); return *this; }
String& String::append( String const &s, size_type s_pos, size_type s_n ) { THIS_STRING->append( *STRING_OF( s ), s_pos, s_n ); return *this; }
String& String::append( String const &s ) { THIS_STRING->append( *STRING_OF( s ) ); return *this; }
void String::swap( String &s ) { THIS_STRING->swap( *STRING_OF( s ) ); }
String::size_type String::find_last_not_of( String const &s, size_type pos ) const { return THIS_STRING->find_last_not_of( *STRING_OF( s ), pos ); }
bool operator<=( String const &s1, String const &s2 ) { return *STRING_OF( s1 ) <= *STRING_OF( s2 ); }
String::size_type String::rfind( String const &s, size_type pos ) const { return THIS_STRING->rfind( *STRING_OF( s ), pos ); }
bool operator<=( String const &s1, String::const_pointer s2 ) { return *STRING_OF( s1 ) <= s2; }
String& String::insert( size_type pos, String const &s ) { THIS_STRING->insert( pos, *STRING_OF( s ) ); return *this; }
bool operator<=( String::const_pointer s1, String const &s2 ) { return s1 <= *STRING_OF( s2 ); }
String& String::insert( size_type pos, String const &s, size_type s_pos, size_type n ) { THIS_STRING->insert( pos, *STRING_OF( s ), s_pos, n ); return *this; }
String operator+( String::const_pointer s1, String const &s2 ) { string_type const s( s1 + *STRING_OF( s2 ) ); String::zstring_ptr const zp = { &s }; return String( zp ); }
String& String::replace( size_type pos, size_type n, String const &s, size_type s_pos, size_type s_n ) { THIS_STRING->replace( pos, n, *STRING_OF( s ), s_pos, s_n ); return *this; }
String::String( String const &s, size_type pos, size_type n ) { new( THIS_STRING ) string_type( *STRING_OF( s ), pos, n ); }
static void test_hashmap_put_get(void** state) { HashMap map = (HashMap)*state; variant_t v1, v2, v3, v4, v5; v1.inum = 1; v2.inum = 2; v3.inum = 123; v4.inum = 456; v5.inum = 999; String_t p1 = STRING_OF("v1"); String_t p2 = STRING_OF("v2"); String_t p3 = STRING_OF("v3"); String_t p4 = STRING_OF("v4"); String_t p5 = STRING_OF("v5"); void* ret; ret = HashMap_put(map, p1, &v1); assert_ptr_equal(ret, &v1); ret = HashMap_put(map, p2, &v2); assert_ptr_equal(ret, &v2); ret = HashMap_put(map, p3, &v3); assert_ptr_equal(ret, &v3); ret = HashMap_put(map, p4, &v4); assert_ptr_equal(ret, &v4); ret = HashMap_put(map, p5, &v5); assert_ptr_equal(ret, &v5); ret = HashMap_put(map, p5, &v5); assert_ptr_equal(ret, NULL); String_t g1 = STRING_OF("v1"); String_t g2 = STRING_OF("v2"); String_t g3 = STRING_OF("v3"); String_t g4 = STRING_OF("v4"); String_t g5 = STRING_OF("v5"); ret = HashMap_get(map, g5); assert_ptr_equal(ret, &v5); assert_int_equal(*(int*)ret, v5.inum); assert_int_equal(HashMap_contains(map, g5), 1); ret = HashMap_get(map, g4); assert_ptr_equal(ret, &v4); assert_int_equal(*(int*)ret, v4.inum); assert_int_equal(HashMap_contains(map, g4), 1); ret = HashMap_get(map, g3); assert_ptr_equal(ret, &v3); assert_int_equal(*(int*)ret, v3.inum); assert_int_equal(HashMap_contains(map, g3), 1); ret = HashMap_get(map, g2); assert_ptr_equal(ret, &v2); assert_int_equal(*(int*)ret, v2.inum); assert_int_equal(HashMap_contains(map, g2), 1); ret = HashMap_get(map, g1); assert_ptr_equal(ret, &v1); assert_int_equal(*(int*)ret, v1.inum); assert_int_equal(HashMap_contains(map, g1), 1); String_t g0 = STRING_OF("vv"); assert_int_equal(HashMap_contains(map, g0), 0); ret = HashMap_delete(map, g0); assert_ptr_equal(ret, NULL); ret = HashMap_delete(map, g3); assert_ptr_not_equal(ret, NULL); ret = HashMap_get(map, g3); assert_ptr_equal(ret, NULL); }