ORCA-C/Tests/Conformance/c24.0.3.cc

102 lines
2.6 KiB
C++
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 <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>;
int <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>;
/* Make sure alpha-"looking" characters are allowed in identifiers,
and that the lowercase versions are distinct from the uppercase
versions. */
fail = false;
<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> = 4;
<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> = 5;
if (<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> != 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, "<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><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><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 ('<EFBFBD>' != 222) {
fail = true;
printf("Character 222 was incorrect in str.\n");
}
if ('<EFBFBD>' != 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 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
1  ! 1 A Q a q <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2  " 2 B R b r <20> <20> <20> <20> <20> <20>
3  # 3 C S c s <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
4  $ 4 D T d t <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
5 % 5 E U e u <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
6 & 6 F V f v <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
7 ' 7 G W g w <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
8 ( 8 H X h x <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
9 ) 9 I Y i y <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
A * 0 J Z j z <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
B + : K [ k { <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
C , ; L \ l | <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
D _ < M ] m } <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
E . = N ^ n ~ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
F / ? O _ o <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
*/
/* Make sure the special operators work */
/* Some lines also test the non-breaking space */
a<EFBFBD>=<EFBFBD>100;
b<EFBFBD>=<EFBFBD>3;
c<EFBFBD>=<EFBFBD>a<EFBFBD>b;
if<EFBFBD>(<EFBFBD>b)
fail = true;
if (! (a <EFBFBD> a))
fail = true;
if (b <EFBFBD> a)
fail = true;
if (! (b <EFBFBD> b))
fail = true;
if (c <EFBFBD> 33)
fail = true;
c = a <EFBFBD> 2;
if (c <EFBFBD> 400)
fail = true;
c = a <EFBFBD> 2;
if (c <EFBFBD> 25)
fail = true;
if (!fail)
printf("Passed Conformance Test 24.0.3\n");
else
printf("Failed Conformance Test 24.0.3\n");
}