Commits

shuerhaaken  committed ef9baff

clean up tests

  • Participants
  • Parent commits ee2806c

Comments (0)

Files changed (13)

File tests/read_ape/main.cc

 using namespace TagInfo;
 
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     
     std::string val = TESTDIR "samples/sample.ape";
     //std::cout << std::endl << "val: " << val << std::endl;
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
      
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            //std::cout << "TagInfo->artist: " << TagInfo->artist << std::endl;
-            if(TagInfo->get_title() == "APE title" && TagInfo->get_artist() == "APE artist") {
-                delete TagInfo;
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->artist: " << info->artist << std::endl;
+            if(info->get_title() == "APE title" && info->get_artist() == "APE artist") {
+                delete info;
                 if(remove(target.c_str()) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;

File tests/read_ext_header/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample_v2_3_ext_header.mp3";
     
     //std::cout << std::endl << "val: " << val << std::endl;
-    
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            //std::cout << "TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "Title v1") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->title: " << info->title << std::endl;
+            if(info->get_title() == "Title v1") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_flac/main.cc

 
 
 int main( void ) {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample.flac";
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo ) {
-        if( TagInfo->read() ) {
-            //std::cout << "TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "FLAC title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->title: " << info->title << std::endl;
+            if(info->get_title() == "FLAC title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_m4a/main.cc

 using namespace TagInfo;
 
 int main( void ) {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample.m4a";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info(val);
-    if(TagInfo) {
-        if( TagInfo->read() ) {
-            //std::cout << "TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "M4A title") {
-                delete TagInfo;
+    info = Info::create_tag_info(val);
+    if(info) {
+        if( info->read() ) {
+            //std::cout << "info->title: " << info->title << std::endl;
+            if(info->get_title() == "M4A title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_mp3_v1/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample_v1_only.mp3";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            if(TagInfo->get_title() == "MP3 title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            if(info->get_title() == "MP3 title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_mp3_v2/main.cc

 using namespace TagInfo;
 
 int main( void ) {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample_v2_only.mp3";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo ) {
-        if( TagInfo->read() ) {
-            //std::cout << "TagInfo->get_title: " << TagInfo->get_title() << std::endl;
-            //std::cout << "TagInfo->artist: " << TagInfo->artist << std::endl;
-            //std::cout << "TagInfo->album: " << TagInfo->album << std::endl;
-            if(TagInfo->get_title() == "MP3 title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->get_title: " << info->get_title() << std::endl;
+            //std::cout << "info->artist: " << info->artist << std::endl;
+            //std::cout << "info->album: " << info->album << std::endl;
+            if(info->get_title() == "MP3 title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_mpc/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample.mpc";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            //std::cout << "TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "MPC title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->title: " << info->title << std::endl;
+            if(info->get_title() == "MPC title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_ogg/main.cc

 using namespace TagInfo;
 
 int main( void ) {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample.ogg";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo ) {
-        if( TagInfo->read() ) {
-            //std::cout << "2TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "OGG title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "2info->title: " << info->title << std::endl;
+            if(info->get_title() == "OGG title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/read_wma/main.cc

 using namespace TagInfo;
 
 int main( void ) {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample.wma";
     //std::cout << std::endl << "val: " << val << std::endl;
     
-    TagInfo = Info::create_tag_info( val );
-    if( TagInfo ) {
-        if( TagInfo->read() ) {
-            //std::cout << "TagInfo->title: " << TagInfo->title << std::endl;
-            if(TagInfo->get_title() == "WMA title") {
-                delete TagInfo;
+    info = Info::create_tag_info( val );
+    if( info ) {
+        if( info->read() ) {
+            //std::cout << "info->title: " << info->title << std::endl;
+            if(info->get_title() == "WMA title") {
+                delete info;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         return EXIT_FAILURE;
     }
 }

File tests/write_m4a/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample.m4a";
     //std::cout << std::endl << "val: " << val << std::endl;
     
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        TagInfo->set_title(TESTNAME);
-        TagInfo->write();
+    info = Info::create_tag_info(target);
+    if( info ) {
+        info->set_title(TESTNAME);
+        info->set_album_artist("äöé");
+        info->write();
     }
-    delete TagInfo;
-    TagInfo = NULL;
+    delete info;
+    info = NULL;
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            if(TagInfo->get_title() == TESTNAME) {
-                delete TagInfo;
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            if(info->get_title() == TESTNAME &&
+               info->get_album_artist() == "äöé") {
+                delete info;
                 if(remove(target.c_str()) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;
     }
     else {
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;

File tests/write_mpc/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample.mpc";
     //std::cout << std::endl << "val: " << val << std::endl;
     
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        TagInfo->set_title(TESTNAME);
-        TagInfo->write();
+    info = Info::create_tag_info(target);
+    if( info ) {
+        info->set_title(TESTNAME);
+        info->set_album_artist("äöé");
+        info->write();
     }
-    delete TagInfo;
-    TagInfo = NULL;
+    delete info;
+    info = NULL;
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            if(TagInfo->get_title() == TESTNAME) {
-                delete TagInfo;
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            if(info->get_title() == TESTNAME &&
+               info->get_album_artist() == "äöé") {
+                delete info;
                 if(remove(target.c_str()) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;
     }
     else {
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;

File tests/write_speex/main.cc

 
 using namespace TagInfo;
 
-int main( void )
-{
-    Info * TagInfo;
+int main( void ) {
+    Info * info;
     std::string val = TESTDIR "samples/sample_empty.spx";
     //std::cout << std::endl << "val: " << val << std::endl;
     
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        TagInfo->set_title(TESTNAME);
-        TagInfo->set_album_artist("äéö");
-        TagInfo->set_is_compilation(true);
-        TagInfo->write();
+    info = Info::create_tag_info(target);
+    if( info ) {
+        info->set_title(TESTNAME);
+        info->set_album_artist("äéö");
+        info->set_is_compilation(true);
+        info->write();
     }
-    delete TagInfo;
-    TagInfo = NULL;
+    delete info;
+    info = NULL;
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
-    {
-        if( TagInfo->read() )
-        {
-            if(TagInfo->get_title() == TESTNAME &&
-               TagInfo->get_is_compilation() == true &&
-               TagInfo->get_album_artist() == "äéö") {
-                delete TagInfo;
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            if(info->get_title() == TESTNAME &&
+               info->get_is_compilation() == true &&
+               info->get_album_artist() == "äéö") {
+                delete info;
                 if(remove(target.c_str()) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;
     }
     else {
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;

File tests/write_wav/main.cc

 
 int main( void )
 {
-    Info * TagInfo;
+    Info * info;
     std::string val = TESTDIR "samples/sample.wav";
     //std::cout << std::endl << "val: " << val << std::endl;
     
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
+    info = Info::create_tag_info(target);
+    if( info )
     {
-        TagInfo->set_title(TESTNAME);
-        TagInfo->set_album_artist("äöé");
-        TagInfo->set_is_compilation(true);
-        TagInfo->write();
+        info->set_title(TESTNAME);
+        info->set_album_artist("äöé");
+        info->set_is_compilation(true);
+        info->write();
     }
-    delete TagInfo;
-    TagInfo = NULL;
+    delete info;
+    info = NULL;
     
-    TagInfo = Info::create_tag_info(target);
-    if( TagInfo )
+    info = Info::create_tag_info(target);
+    if( info )
     {
-        if( TagInfo->read() )
+        if( info->read() )
         {
-            if(TagInfo->get_title() == TESTNAME &&
-               TagInfo->get_album_artist() == "äöé" &&
-               TagInfo->get_is_compilation() == true) {
-                delete TagInfo;
+            if(info->get_title() == TESTNAME &&
+               info->get_album_artist() == "äöé" &&
+               info->get_is_compilation() == true) {
+                delete info;
                 if(remove(target.c_str()) != 0 )
                     return EXIT_FAILURE;
                 return EXIT_SUCCESS;
             }
         }
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;
     }
     else {
-        delete TagInfo;
+        delete info;
         if(remove(target.c_str()) != 0 )
             return EXIT_FAILURE;
         return EXIT_FAILURE;