ORCA-C/Tests/Conformance/C24.0.3.CC

102 lines
2.6 KiB
Plaintext
Raw Normal View History

/* Conformance Test 24.0.3: Test the use of the extended character set */
#pragma lint -1
#include <stdio.h>
#include <string.h>
typedef enum {false, true} boolean;
void main (void)
{
boolean fail;
int a, b, c, i;
char str[128];
int <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ą<EFBFBD><C485><EFBFBD><EFBFBD><EFBFBD>Ƈ<EFBFBD><C687><EFBFBD><EFBFBD><EFBFBD><EFBFBD>؉<EFBFBD><D889><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˌ<EFBFBD><CB8C>̍<EFBFBD><CC8D>͎<EFBFBD><CD8E><EFBFBD><EFBFBD>ޏ<EFBFBD><DE8F><EFBFBD><EFBFBD><EFBFBD>;
int <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ą<EFBFBD><C485><EFBFBD><EFBFBD><EFBFBD>Ƈ<EFBFBD><C687><EFBFBD>˘<EFBFBD>؉<EFBFBD><D889><EFBFBD><EFBFBD><EFBFBD>ͻˁ<CDBB><CB81>̂<EFBFBD><CC82>̓<EFBFBD><CD83><EFBFBD><EFBFBD>ޏ<EFBFBD><DE8F><EFBFBD><EFBFBD><EFBFBD>;
/* Make sure alpha-"looking" characters are allowed in identifiers,
and that the lowercase versions are distinct from the uppercase
versions. */
fail = false;
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ą<EFBFBD><C485><EFBFBD><EFBFBD><EFBFBD>Ƈ<EFBFBD><C687><EFBFBD><EFBFBD><EFBFBD><EFBFBD>؉<EFBFBD><D889><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˌ<EFBFBD><CB8C>̍<EFBFBD><CC8D>͎<EFBFBD><CD8E><EFBFBD><EFBFBD>ޏ<EFBFBD><DE8F><EFBFBD><EFBFBD><EFBFBD> = 4;
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ą<EFBFBD><C485><EFBFBD><EFBFBD><EFBFBD>Ƈ<EFBFBD><C687><EFBFBD>˘<EFBFBD>؉<EFBFBD><D889><EFBFBD><EFBFBD><EFBFBD>ͻˁ<CDBB><CB81>̂<EFBFBD><CC82>̓<EFBFBD><CD83><EFBFBD><EFBFBD>ޏ<EFBFBD><DE8F><EFBFBD><EFBFBD><EFBFBD> = 5;
if (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ą<EFBFBD><C485><EFBFBD><EFBFBD><EFBFBD>Ƈ<EFBFBD><C687><EFBFBD><EFBFBD><EFBFBD><EFBFBD>؉<EFBFBD><D889><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˌ<EFBFBD><CB8C>̍<EFBFBD><CC8D>͎<EFBFBD><CD8E><EFBFBD><EFBFBD>ޏ<EFBFBD><DE8F><EFBFBD><EFBFBD><EFBFBD> != 4)
fail = true;
/* Make sure all special characters are allowed in strings */
strcpy(str, "");
for (i = 17; i <= 20; ++i)
if (str[i - 17] != i) {
fail = true;
printf("Character %d was incorrect in str.\n", i);
}
strcpy(str, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
for (i = 128; i <= 216; ++i)
if (str[i - 128] != i) {
fail = true;
printf("Character %d was incorrect in str.\n", i);
}
if ('<27>' != 222) {
fail = true;
printf("Character 222 was incorrect in str.\n");
}
if ('<27>' != 223) {
fail = true;
printf("Character 223 was incorrect in str.\n");
}
/* Make sure all special characters are allowed in comments */
/* The special character set is:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 @ P ` p <20> <20> <20> <20> <20> <20>
1  ! 1 A Q a q <20> <20> <20> <20> <20> <20>
2  " 2 B R b r <20> <20> <20> <20> <20> <20>
3  # 3 C S c s <20> <20> <20> <20> <20> <20>
4  $ 4 D T d t <20> <20> <20> <20> <20> <20>
5 % 5 E U e u <20> <20> <20> <20> <20> <20>
6 & 6 F V f v <20> <20> <20> <20> <20> <20>
7 ' 7 G W g w <20> <20> <20> <20> <20> <20>
8 ( 8 H X h x <20> <20> <20> <20> <20> <20>
9 ) 9 I Y i y <20> <20> <20> <20> <20>
A * 0 J Z j z <20> <20> <20> <20> <20>
B + : K [ k { <20> <20> <20> <20> <20>
C , ; L \ l | <20> <20> <20> <20> <20>
D _ < M ] m } <20> <20> <20> <20> <20>
E . = N ^ n ~ <20> <20> <20> <20> <20> <20>
F / ? O _ o <20> <20> <20> <20> <20> <20>
*/
/* Make sure the special operators work */
/* Some lines also test the non-breaking space */
a<EFBFBD>=<3D>100;
b<EFBFBD>=<3D>3;
c<EFBFBD>=<3D>a<EFBFBD>b;
if<EFBFBD>(aʲ<61>b)
fail = true;
if (! (a <20> a))
fail = true;
if (b <20> a)
fail = true;
if (! (b <20> b))
fail = true;
if (c <20> 33)
fail = true;
c = a <20> 2;
if (c <20> 400)
fail = true;
c = a <20> 2;
if (c <20> 25)
fail = true;
if (!fail)
printf("Passed Conformance Test 24.0.3\n");
else
printf("Failed Conformance Test 24.0.3\n");
}