rb_cdio 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/VERSION +1 -1
  2. data/ext/CdIo.h +0 -9
  3. data/ext/CdIo_Cd.c +1 -1
  4. data/ext/CdIo_Cdda.c +7 -1
  5. data/ext/extconf.rb +6 -6
  6. data/ext/mkmf.log +45 -20
  7. data/test/{testbincue.rb → test_bincue.rb} +0 -0
  8. data/test/{testclose.rb → test_close.rb} +0 -0
  9. data/test/{testmethods.rb → test_methods.rb} +1 -1
  10. data/test/{testtoc.rb → test_toc.rb} +4 -2
  11. data/test/testall.rb +4 -4
  12. metadata +195 -406
  13. data/doc/classes/CdIo.html +0 -511
  14. data/doc/classes/CdIo.src/M000001.html +0 -17
  15. data/doc/classes/CdIo.src/M000002.html +0 -17
  16. data/doc/classes/CdIo.src/M000003.html +0 -17
  17. data/doc/classes/CdIo.src/M000004.html +0 -17
  18. data/doc/classes/CdIo.src/M000005.html +0 -17
  19. data/doc/classes/CdIo.src/M000006.html +0 -17
  20. data/doc/classes/CdIo.src/M000007.html +0 -17
  21. data/doc/classes/CdIo.src/M000008.html +0 -17
  22. data/doc/classes/CdIo/Cd.html +0 -348
  23. data/doc/classes/CdIo/Cd.src/M000020.html +0 -17
  24. data/doc/classes/CdIo/Cd.src/M000021.html +0 -17
  25. data/doc/classes/CdIo/Cd.src/M000022.html +0 -17
  26. data/doc/classes/CdIo/Cd.src/M000023.html +0 -17
  27. data/doc/classes/CdIo/Cd.src/M000024.html +0 -17
  28. data/doc/classes/CdIo/Cd.src/M000025.html +0 -17
  29. data/doc/classes/CdIo/Cd.src/M000026.html +0 -17
  30. data/doc/classes/CdIo/Cd.src/M000027.html +0 -17
  31. data/doc/classes/CdIo/Cd.src/M000028.html +0 -17
  32. data/doc/classes/CdIo/Cd.src/M000029.html +0 -17
  33. data/doc/classes/CdIo/Cd.src/M000030.html +0 -17
  34. data/doc/classes/CdIo/Cd.src/M000031.html +0 -17
  35. data/doc/classes/CdIo/Cd.src/M000032.html +0 -17
  36. data/doc/classes/CdIo/Cd.src/M000033.html +0 -17
  37. data/doc/classes/CdIo/Cd.src/M000034.html +0 -17
  38. data/doc/classes/CdIo/Cd.src/M000035.html +0 -17
  39. data/doc/classes/CdIo/Cdda.html +0 -428
  40. data/doc/classes/CdIo/Cdda.src/M000009.html +0 -17
  41. data/doc/classes/CdIo/Cdda.src/M000010.html +0 -17
  42. data/doc/classes/CdIo/Cdda.src/M000011.html +0 -17
  43. data/doc/classes/CdIo/Cdda.src/M000012.html +0 -17
  44. data/doc/classes/CdIo/Cdda.src/M000013.html +0 -17
  45. data/doc/classes/CdIo/Cdda.src/M000014.html +0 -17
  46. data/doc/classes/CdIo/Cdda.src/M000015.html +0 -17
  47. data/doc/classes/CdIo/Cdda.src/M000016.html +0 -17
  48. data/doc/classes/CdIo/Cdda.src/M000017.html +0 -17
  49. data/doc/classes/CdIo/Cdda.src/M000018.html +0 -17
  50. data/doc/classes/CdIo/Cdda.src/M000019.html +0 -17
  51. data/doc/classes/CdIo/Cdda.src/M000020.html +0 -17
  52. data/doc/classes/CdIo/Cdda.src/M000021.html +0 -17
  53. data/doc/classes/CdIo/Cdda.src/M000022.html +0 -17
  54. data/doc/classes/CdIo/Cdda.src/M000023.html +0 -17
  55. data/doc/classes/CdIo/Cdda.src/M000024.html +0 -17
  56. data/doc/classes/CdIo/Exception.html +0 -118
  57. data/doc/classes/CdIo/Exception/BadParameter.html +0 -111
  58. data/doc/classes/CdIo/Exception/BadPointer.html +0 -111
  59. data/doc/classes/CdIo/Exception/CddbConn.html +0 -111
  60. data/doc/classes/CdIo/Exception/CddbError.html +0 -111
  61. data/doc/classes/CdIo/Exception/Error.html +0 -111
  62. data/doc/classes/CdIo/Exception/NoDriver.html +0 -111
  63. data/doc/classes/CdIo/Exception/NotPermitted.html +0 -111
  64. data/doc/classes/CdIo/Exception/Unsupported.html +0 -111
  65. data/doc/classes/CdIo/Track.html +0 -246
  66. data/doc/classes/CdIo/Track.src/M000017.html +0 -17
  67. data/doc/classes/CdIo/Track.src/M000018.html +0 -17
  68. data/doc/classes/CdIo/Track.src/M000019.html +0 -17
  69. data/doc/classes/CdIo/Track.src/M000025.html +0 -17
  70. data/doc/classes/CdIo/Track.src/M000026.html +0 -17
  71. data/doc/classes/CdIo/Track.src/M000027.html +0 -17
  72. data/doc/classes/CdIo/TrackCdda.html +0 -169
  73. data/doc/classes/CdIo/TrackCdda.src/M000031.html +0 -17
  74. data/doc/classes/CdIo/TrackCdda.src/M000039.html +0 -17
  75. data/doc/classes/CdIo/TrackCdda.src/M000040.html +0 -17
  76. data/doc/classes/CdIo/TrackCdda.src/M000041.html +0 -17
  77. data/doc/classes/CdIo/TrackIso9660.html +0 -159
  78. data/doc/classes/CdIo/Tracks.html +0 -199
  79. data/doc/classes/CdIo/Tracks.src/M000028.html +0 -17
  80. data/doc/classes/CdIo/Tracks.src/M000029.html +0 -17
  81. data/doc/classes/CdIo/Tracks.src/M000030.html +0 -17
  82. data/doc/classes/CdIo/Tracks.src/M000036.html +0 -17
  83. data/doc/classes/CdIo/Tracks.src/M000037.html +0 -17
  84. data/doc/classes/CdIo/Tracks.src/M000038.html +0 -17
  85. data/doc/created.rid +0 -1
  86. data/doc/files/__/rb_cdio_def_rb.html +0 -235
  87. data/doc/files/rb_cdio_def_rb.html +0 -244
  88. data/doc/fr_class_index.html +0 -42
  89. data/doc/fr_file_index.html +0 -27
  90. data/doc/fr_method_index.html +0 -67
  91. data/doc/index.html +0 -24
  92. data/mkmf.log +0 -26
  93. data/svn-commit.tmp +0 -5
  94. data/tags +0 -47
  95. data/test/data/check_common_fn.in +0 -186
  96. data/test/data/check_cue.sh.in +0 -117
  97. data/test/data/check_iso.sh.in +0 -52
  98. data/test/data/check_nrg.sh.in +0 -70
  99. data/test/data/check_paranoia.sh.in +0 -78
  100. data/test/data/check_sizeof +0 -117
  101. data/test/data/check_sizeof.c +0 -77
  102. data/test/data/testassert.c +0 -36
  103. data/test/data/testbincue.c +0 -104
  104. data/test/data/testdefault.c +0 -202
  105. data/test/data/testischar.c +0 -71
  106. data/test/data/testiso9660.c +0 -158
  107. data/test/data/testparanoia.c +0 -185
  108. data/test/data/testtoc.c +0 -114
@@ -1,71 +0,0 @@
1
- /*
2
- $Id: testischar.c,v 1.1 2003/08/17 05:31:19 rocky Exp $
3
-
4
- Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
5
-
6
- This program is free software; you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation; either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program; if not, write to the Free Software
18
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
- /* Tests ISO9660 character sets. */
21
-
22
- #ifdef HAVE_CONFIG_H
23
- # include "config.h"
24
- #endif
25
-
26
- #include <stdio.h>
27
- #include <cdio/iso9660.h>
28
-
29
- int
30
- main (int argc, const char *argv[])
31
- {
32
- int i, j;
33
-
34
- printf (" ");
35
-
36
- for (j = 0; j < 0x10; j++)
37
- printf (" %1.1x", j);
38
-
39
- printf (" |");
40
-
41
- for (j = 0; j < 0x10; j++)
42
- printf (" %1.1x", j);
43
-
44
- printf ("\n");
45
-
46
- for (i = 0; i < 0x10; i++)
47
- {
48
-
49
- printf ("%1.1x ", i);
50
-
51
- for (j = 0; j < 0x10; j++)
52
- {
53
- int c = (j << 4) + i;
54
-
55
- printf (" %c", iso9660_isdchar (c) ? c : ' ');
56
- }
57
-
58
- printf (" |");
59
-
60
- for (j = 0; j < 0x10; j++)
61
- {
62
- int c = (j << 4) + i;
63
-
64
- printf (" %c", iso9660_isachar (c) ? c : ' ');
65
- }
66
-
67
- printf ("\n");
68
- }
69
-
70
- return 0;
71
- }
@@ -1,158 +0,0 @@
1
- /*
2
- $Id: testiso9660.c,v 1.4 2005/03/03 10:33:26 rocky Exp $
3
-
4
- Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
5
-
6
- This program is free software; you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation; either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program; if not, write to the Free Software
18
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
- /* Tests ISO9660 library routines. */
21
-
22
- #ifdef HAVE_CONFIG_H
23
- # include "config.h"
24
- #endif
25
-
26
- #include <ctype.h>
27
- #ifdef HAVE_STDLIB_H
28
- #include <stdlib.h>
29
- #endif
30
- #ifdef HAVE_STRING_H
31
- #include <string.h>
32
- #endif
33
- #ifdef HAVE_STDIO_H
34
- #include <stdio.h>
35
- #endif
36
- #include <cdio/iso9660.h>
37
-
38
- int
39
- main (int argc, const char *argv[])
40
- {
41
- int c;
42
- int i;
43
- char dst[100];
44
- char *dst_p;
45
- int achars[] = {'!', '"', '%', '&', '(', ')', '*', '+', ',', '-', '.',
46
- '/', '?', '<', '=', '>'};
47
- for (c='A'; c<='Z'; c++ ) {
48
- if (!iso9660_isdchar(c)) {
49
- printf("Failed iso9660_isdchar test on %d\n", c);
50
- return c;
51
- }
52
- if (!iso9660_isachar(c)) {
53
- printf("Failed iso9660_isachar test on %d\n", c);
54
- return c;
55
- }
56
- }
57
- for (c='0'; c<='9'; c++ ) {
58
- if (!iso9660_isdchar(c)) {
59
- printf("Failed iso9660_isdchar test on %d\n", c);
60
- return c;
61
- }
62
- if (!iso9660_isachar(c)) {
63
- printf("Failed iso9660_isachar test on %d\n", c);
64
- return c;
65
- }
66
- }
67
-
68
- for (i=0; i<=13; i++ ) {
69
- c=achars[i];
70
- if (iso9660_isdchar(c)) {
71
- printf("Should not pass iso9660_isdchar test on %d\n", c);
72
- return c;
73
- }
74
- if (!iso9660_isachar(c)) {
75
- printf("Failed iso9660_isachar test on symbol %d\n", c);
76
- return c;
77
- }
78
- }
79
-
80
- /* Test iso9660_strncpy_pad */
81
- dst_p = iso9660_strncpy_pad(dst, "1_3", 5, ISO9660_DCHARS);
82
- if ( 0 != strncmp(dst, "1_3 ", 5) ) {
83
- printf("Failed iso9660_strncpy_pad test 1\n");
84
- return 1;
85
- }
86
- dst_p = iso9660_strncpy_pad(dst, "ABC!123", 2, ISO9660_ACHARS);
87
- if ( 0 != strncmp(dst, "AB", 2) ) {
88
- printf("Failed iso9660_strncpy_pad test 2\n");
89
- return 2;
90
- }
91
-
92
- /* Test iso9660_dirname_valid_p */
93
- if ( iso9660_dirname_valid_p("/NOGOOD") ) {
94
- printf("/NOGOOD should fail iso9660_dirname_valid_p\n");
95
- return 3;
96
- }
97
- if ( iso9660_dirname_valid_p("LONGDIRECTORY/NOGOOD") ) {
98
- printf("LONGDIRECTORY/NOGOOD should fail iso9660_dirname_valid_p\n");
99
- return 4;
100
- }
101
- if ( !iso9660_dirname_valid_p("OKAY/DIR") ) {
102
- printf("OKAY/DIR should pass iso9660_dirname_valid_p\n");
103
- return 5;
104
- }
105
- if ( iso9660_dirname_valid_p("OKAY/FILE.EXT") ) {
106
- printf("OKAY/FILENAME.EXT should fail iso9660_dirname_valid_p\n");
107
- return 6;
108
- }
109
-
110
- /* Test iso9660_pathname_valid_p */
111
- if ( !iso9660_pathname_valid_p("OKAY/FILE.EXT") ) {
112
- printf("OKAY/FILE.EXT should pass iso9660_dirname_valid_p\n");
113
- return 7;
114
- }
115
- if ( iso9660_pathname_valid_p("OKAY/FILENAMETOOLONG.EXT") ) {
116
- printf("OKAY/FILENAMETOOLONG.EXT should fail iso9660_dirname_valid_p\n");
117
- return 8;
118
- }
119
- if ( iso9660_pathname_valid_p("OKAY/FILE.LONGEXT") ) {
120
- printf("OKAY/FILE.LONGEXT should fail iso9660_dirname_valid_p\n");
121
- return 9;
122
- }
123
-
124
- dst_p = iso9660_pathname_isofy ("this/file.ext", 1);
125
- if ( 0 != strncmp(dst_p, "this/file.ext;1", 16) ) {
126
- printf("Failed iso9660_pathname_isofy\n");
127
- free(dst_p);
128
- return 10;
129
- }
130
- free(dst_p);
131
-
132
- /* Test get/set date */
133
- {
134
- struct tm *p_tm, tm;
135
- iso9660_dtime_t dtime;
136
- time_t now = time(NULL);
137
-
138
- memset(&dtime, 0, sizeof(dtime));
139
- p_tm = localtime(&now);
140
- iso9660_set_dtime(p_tm, &dtime);
141
- iso9660_get_dtime(&dtime, true, &tm);
142
- if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
143
- printf("Local time retrieved with iso9660_get_dtime not same as\n");
144
- printf("that set with iso9660_set_dtime().\n");
145
- return 11;
146
- }
147
- p_tm = gmtime(&now);
148
- iso9660_set_dtime(p_tm, &dtime);
149
- iso9660_get_dtime(&dtime, false, &tm);
150
- if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
151
- printf("GMT time retrieved with iso9660_get_dtime() not same as that\n");
152
- printf("set with iso9660_set_dtime().\n");
153
- return 12;
154
- }
155
- }
156
-
157
- return 0;
158
- }
@@ -1,185 +0,0 @@
1
- /*
2
- * Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2, or (at your option)
7
- * any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software
16
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
- *
18
- */
19
- /* Simple program to show using libcdio's version of cdparanoia. */
20
-
21
- #ifdef HAVE_CONFIG_H
22
- # include "config.h"
23
- #endif
24
-
25
- #include <cdio/cdda.h>
26
- #include <cdio/cd_types.h>
27
- #include <stdio.h>
28
-
29
- #ifdef HAVE_STDLIB_H
30
- #include <stdlib.h>
31
- #endif
32
-
33
- #ifdef HAVE_STRING_H
34
- #include <string.h>
35
- #endif
36
-
37
- #ifdef WORDS_BIGENDIAN
38
- #define BIGENDIAN 1
39
- #else
40
- #define BIGENDIAN 0
41
- #endif
42
-
43
- #define SKIP_TEST_RC 77
44
-
45
- #define MAX_SECTORS 50
46
- uint8_t audio_buf[MAX_SECTORS][CDIO_CD_FRAMESIZE_RAW] = { {0}, };
47
- paranoia_cb_mode_t audio_status[MAX_SECTORS];
48
- unsigned int i = 0;
49
-
50
- static void
51
- callback(long int inpos, paranoia_cb_mode_t function)
52
- {
53
- audio_status[i] = function;
54
- }
55
-
56
- int
57
- main(int argc, const char *argv[])
58
- {
59
- cdrom_drive_t *d = NULL; /* Place to store handle given by cd-parapnioa. */
60
- driver_id_t driver_id;
61
- char **ppsz_cd_drives; /* List of all drives with a loaded CDDA in it. */
62
- int i_rc=0;
63
-
64
- /* See if we can find a device with a loaded CD-DA in it. If successful
65
- drive_id will be set. */
66
- ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false,
67
- &driver_id);
68
-
69
- if (ppsz_cd_drives && *ppsz_cd_drives) {
70
- /* Found such a CD-ROM with a CD-DA loaded. Use the first drive in
71
- the list. */
72
- d=cdda_identify(*ppsz_cd_drives, 1, NULL);
73
- } else {
74
- printf("Unable find or access a CD-ROM drive with an audio CD in it.\n");
75
- exit(SKIP_TEST_RC);
76
- }
77
-
78
- /* Don't need a list of CD's with CD-DA's any more. */
79
- cdio_free_device_list(ppsz_cd_drives);
80
-
81
- /* We'll set for verbose paranoia messages. */
82
- cdda_verbose_set(d, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT);
83
-
84
- if ( 0 != cdio_cddap_open(d) ) {
85
- printf("Unable to open disc.\n");
86
- exit(SKIP_TEST_RC);
87
- }
88
-
89
- /* Okay now set up to read up to the first 300 frames of the first
90
- audio track of the Audio CD. */
91
- {
92
- cdrom_paranoia_t *p = paranoia_init(d);
93
- lsn_t i_first_lsn = cdda_disc_firstsector(d);
94
-
95
- if ( -1 == i_first_lsn ) {
96
- printf("Trouble getting starting LSN\n");
97
- } else {
98
- lsn_t i_lsn; /* Current LSN to read */
99
- lsn_t i_last_lsn = cdda_disc_lastsector(d);
100
- unsigned int i_sectors = i_last_lsn - i_first_lsn + 1;
101
- unsigned int j;
102
- unsigned int i_good = 0;
103
- unsigned int i_bad = 0;
104
-
105
- /* Set reading mode for full paranoia, but allow skipping sectors. */
106
- paranoia_modeset(p, PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP);
107
-
108
- for ( j=0; j<10; j++ ) {
109
-
110
- /* Pick a place to start reading. */
111
- i_lsn = i_first_lsn + (rand() % i_sectors);
112
- paranoia_seek(p, i_lsn, SEEK_SET);
113
-
114
- printf("Testing %d sectors starting at %ld\n",
115
- MAX_SECTORS, (long int) i_lsn);
116
- for ( i = 0;
117
- i < MAX_SECTORS && i_lsn <= i_last_lsn;
118
- i++, i_lsn++ ) {
119
- /* read a sector */
120
- int16_t *p_readbuf = paranoia_read(p, callback);
121
- char *psz_err=cdio_cddap_errors(d);
122
- char *psz_mes=cdio_cddap_messages(d);
123
-
124
- memcpy(audio_buf[i], p_readbuf, CDIO_CD_FRAMESIZE_RAW);
125
-
126
- if (psz_mes || psz_err)
127
- printf("%s%s\n", psz_mes ? psz_mes: "", psz_err ? psz_err: "");
128
-
129
- if (psz_err) free(psz_err);
130
- if (psz_mes) free(psz_mes);
131
- if( !p_readbuf ) {
132
- printf("paranoia read error. Stopping.\n");
133
- goto out;
134
- }
135
- }
136
-
137
- /* Compare with the sectors from paranoia. */
138
- i_lsn -= MAX_SECTORS;
139
- for ( i = 0; i < MAX_SECTORS; i++, i_lsn++ ) {
140
- uint8_t readbuf[CDIO_CD_FRAMESIZE_RAW] = {0,};
141
- if ( PARANOIA_CB_READ == audio_status[i] ||
142
- PARANOIA_CB_VERIFY == audio_status[i] ) {
143
- /* We read the block via paranoia without an error. */
144
-
145
- if ( 0 == cdio_read_audio_sector(d->p_cdio, readbuf, i_lsn) ) {
146
- if ( BIGENDIAN != d->bigendianp ) {
147
- /* We will compare in the slow, pedantic way*/
148
- int j;
149
- for (j=0; j < CDIO_CD_FRAMESIZE_RAW ; j +=2) {
150
- if (audio_buf[i][j] != readbuf[j+1] &&
151
- audio_buf[i][j+1] != readbuf[j] ) {
152
- printf("LSN %ld doesn't match\n", (long int) i_lsn);
153
- i_bad++;
154
- } else {
155
- i_good++;
156
- }
157
- }
158
- } else {
159
- if ( 0 != memcmp(audio_buf[i], readbuf,
160
- CDIO_CD_FRAMESIZE_RAW) ) {
161
- printf("LSN %ld doesn't match\n", (long int) i_lsn);
162
- i_bad++;
163
- } else {
164
- i_good++;
165
- }
166
- }
167
- }
168
- } else {
169
- printf("Skipping LSN %ld because of status: %s\n",
170
- (long int) i_lsn, paranoia_cb_mode2str[audio_status[i]]);
171
- }
172
- }
173
- }
174
- printf("%u sectors compared okay %u sectors were different\n",
175
- i_good, i_bad);
176
- if (i_bad > i_good) i_rc = 1;
177
- }
178
- out: paranoia_free(p);
179
- }
180
-
181
- cdio_cddap_close(d);
182
-
183
- exit(i_rc);
184
- }
185
-
@@ -1,114 +0,0 @@
1
- /*
2
- $Id: testtoc.c,v 1.8 2005/01/23 00:45:57 rocky Exp $
3
-
4
- Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
5
-
6
- This program is free software; you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation; either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program; if not, write to the Free Software
18
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- */
20
-
21
- /*
22
- Regression test for cdio_tocfile.
23
- */
24
- #ifdef HAVE_CONFIG_H
25
- # include "config.h"
26
- #endif
27
- #include <cdio/cdio.h>
28
- #include <cdio/logging.h>
29
-
30
- #ifdef HAVE_STDIO_H
31
- #include <stdio.h>
32
- #endif
33
- #ifdef HAVE_SYS_TYPES_H
34
- #include <sys/types.h>
35
- #endif
36
- #ifdef HAVE_STDLIB_H
37
- #include <stdlib.h>
38
- #endif
39
- #include <string.h>
40
-
41
- #ifndef TEST_DIR
42
- #define TEST_DIR "."
43
- #endif
44
-
45
- #define NUM_GOOD_TOCS 16
46
- #define NUM_BAD_TOCS 8
47
- int
48
- main(int argc, const char *argv[])
49
- {
50
- const char *toc_file[NUM_GOOD_TOCS] = {
51
- "cdtext.toc",
52
- "t1.toc",
53
- "t2.toc",
54
- "t3.toc",
55
- "t4.toc",
56
- "t5.toc",
57
- "t6.toc",
58
- "t7.toc",
59
- "t8.toc",
60
- "t9.toc",
61
- "data1.toc",
62
- "data2.toc",
63
- "data5.toc",
64
- "data6.toc",
65
- "data7.toc",
66
- "vcd2.toc",
67
- };
68
-
69
- const char *badtoc_file[NUM_BAD_TOCS] = {
70
- "bad-msf-1.toc",
71
- "bad-msf-2.toc",
72
- "bad-msf-3.toc",
73
- "bad-cat1.toc",
74
- "bad-cat2.toc",
75
- "bad-cat3.toc",
76
- "bad-file.toc",
77
- "bad-mode1.toc"
78
- };
79
- int ret=0;
80
- unsigned int i;
81
- char psz_tocfile[500];
82
-
83
- psz_tocfile[sizeof(psz_tocfile)-1] = '\0';
84
-
85
- cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
86
- for (i=0; i<NUM_GOOD_TOCS; i++) {
87
- snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
88
- "%s/%s", TEST_DIR, toc_file[i]);
89
- if (!cdio_is_tocfile(psz_tocfile)) {
90
- printf("Incorrect: %s doesn't parse as a cdrdao TOC file.\n",
91
- toc_file[i]);
92
- ret=i+1;
93
- } else {
94
- printf("Correct: %s parses as a cdrdao TOC file.\n",
95
- toc_file[i]);
96
- }
97
- }
98
-
99
- for (i=0; i<NUM_BAD_TOCS; i++) {
100
- snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
101
- "%s/%s", TEST_DIR, badtoc_file[i]);
102
- if (!cdio_is_tocfile(psz_tocfile)) {
103
- printf("Correct: %s doesn't parse as a cdrdao TOC file.\n",
104
- badtoc_file[i]);
105
- } else {
106
- printf("Incorrect: %s parses as a cdrdao TOC file.\n",
107
- badtoc_file[i]);
108
- ret+=50*i+1;
109
- break;
110
- }
111
- }
112
-
113
- return ret;
114
- }