Revise test to be more informative
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: testiso9660.c,v 1.4 2005/03/03 10:33:26 rocky Exp $
|
$Id: testiso9660.c,v 1.5 2006/02/25 11:58:22 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -40,52 +40,60 @@ main (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int i;
|
int i;
|
||||||
|
int i_bad = 0;
|
||||||
char dst[100];
|
char dst[100];
|
||||||
char *dst_p;
|
char *dst_p;
|
||||||
int achars[] = {'!', '"', '%', '&', '(', ')', '*', '+', ',', '-', '.',
|
int achars[] = {'!', '"', '%', '&', '(', ')', '*', '+', ',', '-', '.',
|
||||||
'/', '?', '<', '=', '>'};
|
'/', '?', '<', '=', '>'};
|
||||||
for (c='A'; c<='Z'; c++ ) {
|
for (c='A'; c<='Z'; c++ ) {
|
||||||
if (!iso9660_isdchar(c)) {
|
if (!iso9660_isdchar(c)) {
|
||||||
printf("Failed iso9660_isdchar test on %d\n", c);
|
printf("Failed iso9660_isdchar test on %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_isachar(c)) {
|
||||||
printf("Failed iso9660_isachar test on %d\n", c);
|
printf("Failed iso9660_isachar test on %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i_bad) return i_bad;
|
||||||
|
|
||||||
for (c='0'; c<='9'; c++ ) {
|
for (c='0'; c<='9'; c++ ) {
|
||||||
if (!iso9660_isdchar(c)) {
|
if (!iso9660_isdchar(c)) {
|
||||||
printf("Failed iso9660_isdchar test on %d\n", c);
|
printf("Failed iso9660_isdchar test on %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_isachar(c)) {
|
||||||
printf("Failed iso9660_isachar test on %d\n", c);
|
printf("Failed iso9660_isachar test on %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i_bad) return i_bad;
|
||||||
|
|
||||||
for (i=0; i<=13; i++ ) {
|
for (i=0; i<=13; i++ ) {
|
||||||
c=achars[i];
|
c=achars[i];
|
||||||
if (iso9660_isdchar(c)) {
|
if (iso9660_isdchar(c)) {
|
||||||
printf("Should not pass iso9660_isdchar test on %d\n", c);
|
printf("Should not pass iso9660_isdchar test on %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
if (!iso9660_isachar(c)) {
|
if (!iso9660_isachar(c)) {
|
||||||
printf("Failed iso9660_isachar test on symbol %d\n", c);
|
printf("Failed iso9660_isachar test on symbol %c\n", c);
|
||||||
return c;
|
i_bad++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i_bad) return i_bad;
|
||||||
|
|
||||||
/* Test iso9660_strncpy_pad */
|
/* Test iso9660_strncpy_pad */
|
||||||
dst_p = iso9660_strncpy_pad(dst, "1_3", 5, ISO9660_DCHARS);
|
dst_p = iso9660_strncpy_pad(dst, "1_3", 5, ISO9660_DCHARS);
|
||||||
if ( 0 != strncmp(dst, "1_3 ", 5) ) {
|
if ( 0 != strncmp(dst, "1_3 ", 5) ) {
|
||||||
printf("Failed iso9660_strncpy_pad test 1\n");
|
printf("Failed iso9660_strncpy_pad DCHARS\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dst_p = iso9660_strncpy_pad(dst, "ABC!123", 2, ISO9660_ACHARS);
|
dst_p = iso9660_strncpy_pad(dst, "ABC!123", 2, ISO9660_ACHARS);
|
||||||
if ( 0 != strncmp(dst, "AB", 2) ) {
|
if ( 0 != strncmp(dst, "AB", 2) ) {
|
||||||
printf("Failed iso9660_strncpy_pad test 2\n");
|
printf("Failed iso9660_strncpy_pad ACHARS truncation\n");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user