diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2007-06-14 19:06:58 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2007-06-14 19:06:58 +1000 |
commit | a7749dc5d44c30000ea89fbccf12480d6b87cc58 (patch) | |
tree | fe3a5b9cf68ad1cfabe6060405df62a848be688f /tests/cpp_test.cc | |
parent | 259a3fbc6035a15c9c99c9fbd2647fba625470bf (diff) |
tests/cpp_test.cc : Add extra tests for when the SndfileHandle constructor fails.
Diffstat (limited to 'tests/cpp_test.cc')
-rw-r--r-- | tests/cpp_test.cc | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/tests/cpp_test.cc b/tests/cpp_test.cc index 9108aa1..213b654 100644 --- a/tests/cpp_test.cc +++ b/tests/cpp_test.cc @@ -178,6 +178,35 @@ ceeplusplus_test (const char *filename, int format) puts ("ok") ; } /* ceeplusplus_test */ +static void +ceeplusplus_extra_test (void) +{ SndfileHandle file ; + const char * filename = "bad_file_name.wav" ; + int error ; + + print_test_name ("ceeplusplus_extra_test", filename) ; + + file = SndfileHandle (filename) ; + + error = file.error () ; + if (error == 0) + { printf ("\n\n%s %d : error should be zero.\n\n", __func__, __LINE__) ; + exit (1) ; + } ; + + if (file.strError () == NULL) + { printf ("\n\n%s %d : strError should not return NULL.\n\n", __func__, __LINE__) ; + exit (1) ; + } ; + + if (file.seek (0, SEEK_SET) != 0) + { printf ("\n\n%s %d : bad seek ().\n\n", __func__, __LINE__) ; + exit (1) ; + } ; + + puts ("ok") ; +} /* ceeplusplus_extra_test */ + int main (void) { @@ -185,13 +214,8 @@ main (void) ceeplusplus_test ("cpp_test.aiff", SF_FORMAT_AIFF | SF_FORMAT_PCM_S8) ; ceeplusplus_test ("cpp_test.au", SF_FORMAT_AU | SF_FORMAT_FLOAT) ; + ceeplusplus_extra_test () ; + return 0 ; } /* main */ -/* -** Do not edit or modify anything in this comment block. -** The following line is a file identity tag for the GNU Arch -** revision control system. -** -** arch-tag: 06e48ee6-b19d-4453-9999-a5cf2d7bf0b6 -*/ |