- void name_check_equal(const name_t& name, const char* string, unsigned int postfix)
- {
- ASSERT_MESSAGE(strcmp(name.first.c_str(), string) == 0
- && name.second.number() == postfix,
- "test failed!");
- }
- void test_refcount()
- {
- Names names;
-
- names.insert(name_t("func_bleh_", "100"));
- names.insert(name_t("func_bleh_", "100"));
- names.insert(name_t("func_bleh_", "100"));
-
-
- names.erase(name_t("func_bleh_", "100"));
- names.erase(name_t("func_bleh_", "100"));
- names.erase(name_t("func_bleh_", "100"));
-
- ASSERT_MESSAGE(names.empty(), "test failed!");
- }
-
- void test_make_unique()
- {
- Names names;
-
- {
- name_t name(names.make_unique(name_t("func_bleh_", "01")));
- name_check_equal(name, "func_bleh_", 1);
- names.insert(name);
- }
- {
- name_t name(names.make_unique(name_t("func_bleh_", "04")));
- name_check_equal(name, "func_bleh_", 4);
- names.insert(name);
- }
- {
- name_t name(names.make_unique(name_t("func_bleh_", "04")));
- name_check_equal(name, "func_bleh_", 2);
- names.insert(name);
- }
- {
- name_t name(names.make_unique(name_t("func_bleh_", "1")));
- name_check_equal(name, "func_bleh_", 3);
- names.insert(name);
- }
- {
- name_t name(names.make_unique(name_t("func_bleh_", "2")));
- name_check_equal(name, "func_bleh_", 5);
- names.insert(name);
- }
- {
- name_t name(names.make_unique(name_t("func_bleh_", "3")));
- name_check_equal(name, "func_bleh_", 6);
- names.insert(name);
- }
-
- names.erase(name_t("func_bleh_", "1"));
- names.erase(name_t("func_bleh_", "2"));
- names.erase(name_t("func_bleh_", "3"));
- names.erase(name_t("func_bleh_", "4"));
- names.erase(name_t("func_bleh_", "5"));
- names.erase(name_t("func_bleh_", "6"));
-
- ASSERT_MESSAGE(names.empty(), "test failed!");
- }
+void name_check_equal( const name_t& name, const char* string, unsigned int postfix ){
+ ASSERT_MESSAGE( strcmp( name.first.c_str(), string ) == 0
+ && name.second.number() == postfix,
+ "test failed!" );
+}
+void test_refcount(){
+ Names names;
+
+ names.insert( name_t( "func_bleh_", "100" ) );
+ names.insert( name_t( "func_bleh_", "100" ) );
+ names.insert( name_t( "func_bleh_", "100" ) );
+
+
+ names.erase( name_t( "func_bleh_", "100" ) );
+ names.erase( name_t( "func_bleh_", "100" ) );
+ names.erase( name_t( "func_bleh_", "100" ) );
+
+ ASSERT_MESSAGE( names.empty(), "test failed!" );
+}
+
+void test_make_unique(){
+ Names names;
+
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "01" ) ) );
+ name_check_equal( name, "func_bleh_", 1 );
+ names.insert( name );
+ }
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "04" ) ) );
+ name_check_equal( name, "func_bleh_", 4 );
+ names.insert( name );
+ }
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "04" ) ) );
+ name_check_equal( name, "func_bleh_", 2 );
+ names.insert( name );
+ }
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "1" ) ) );
+ name_check_equal( name, "func_bleh_", 3 );
+ names.insert( name );
+ }
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "2" ) ) );
+ name_check_equal( name, "func_bleh_", 5 );
+ names.insert( name );
+ }
+ {
+ name_t name( names.make_unique( name_t( "func_bleh_", "3" ) ) );
+ name_check_equal( name, "func_bleh_", 6 );
+ names.insert( name );
+ }
+
+ names.erase( name_t( "func_bleh_", "1" ) );
+ names.erase( name_t( "func_bleh_", "2" ) );
+ names.erase( name_t( "func_bleh_", "3" ) );
+ names.erase( name_t( "func_bleh_", "4" ) );
+ names.erase( name_t( "func_bleh_", "5" ) );
+ names.erase( name_t( "func_bleh_", "6" ) );
+
+ ASSERT_MESSAGE( names.empty(), "test failed!" );
+}