From 8d2ec80d5af44d221b2ad347db1d7ddae30c901c Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 15:30:07 +0100 Subject: [PATCH 01/22] cleanup --- test/val/add1.o | Bin 6483 -> 0 bytes test/val/add1.prg | Bin 3113 -> 0 bytes test/val/add3.o | Bin 22855 -> 0 bytes test/val/add3.prg | Bin 5022 -> 0 bytes test/val/add4.o | Bin 5552 -> 0 bytes test/val/add4.prg | Bin 3019 -> 0 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/val/add1.o delete mode 100644 test/val/add1.prg delete mode 100644 test/val/add3.o delete mode 100644 test/val/add3.prg delete mode 100644 test/val/add4.o delete mode 100644 test/val/add4.prg diff --git a/test/val/add1.o b/test/val/add1.o deleted file mode 100644 index bc6b2f50511213499261fc384d39aeb940fc73b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6483 zcmZWt2Xs``7QN?A>R=!sB_POHutG=`M_ z(+r={__V-h96s?0#?;_59df(o#yly;JO`!4d?m*FV~y$1&X^t`ZfkE0)Mf>E9S1ed zUDkE|wmnmpM7yG_{m0S^ha5?6nOJebkT+V#3_Qn}>r8F5*i|lLml`QH5|RVrmKs-; zt^wIdj`T2+B$>t*ifjT=FAE|}7Jv!JRBL2}UP=UO6%wm?Q&ON`+?PW+t?7YaP#H*`-EW8M_i1T4$gyk`T@~LH!m*q`JuQxj{=P z4BHi=fEMy1VtC{X3pfM0(e?wnh+f;TDf_!MdrY`^6%0Z$%Z5{%g>rJ_Nnnypvdn%r zjOryPY?GtuKLsVye+iZ$X%o(+jV9rDSDzz(b(`bF<_64hTrN|O$q`je)(uFM?Fi+O zRPBGNX5XIKD|&7FrtE7pdrY|YBO0h(IInh^`hM6aNjft>S2I`_QQbN$5s(h_{s2K% z8d(LZUJg3x#34Ln>gy3GB-b)L`D>BoNO_f69!Hm($#IyRv9H;E;9O0k7h`icnX37k zD<;TavdL`L@Y#(1GJ3Jn$~~Iw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 zI=1T&>C2RvMsW)9c}M24T}AmBqF)X1dXB4HaUz3EAg-Xr?W$YE)!!lUHE|8`S>i5g zyQ=@oB$g1PuvvCNrIKv@U(Fp0w{dpTtu#k@A%qHrq7w z`3Cp9<*Lk-G@mcVKXPPhaxf{+e^sXE_O#^G3{N*t-@*#d$R3%auFgwqpO**47|;J} zY_KdUSe{=Hi%-x$CSS)~f63^misG_Vg*1h9g^Z}Oit<#2G=+49jBC0FN{jQm7nGOg zm-)wa&(05yt|%?*uIqI#D69xn<~p)JSX@|=*S)B;q#(E4Uy>I{F81eX2}8054H-Jn z=Zp1~l^2#&jEeIGEA#U5gTZ*;D1Tv5WqE!u#y7IExcI>spC1M(&X5}G^XCQpU|0U9*eZ^QVIyqQ4E>E;U6pshN%@m6I%DcC1=e7FFmh%`xjkxkpS{Wia3$8&^>pL{9#( zWV031X_uZ(nbFd-oX}~`Kut!b>NB`b#!V_`W)OQs-8dk-Pt2eJ*;zxfTsI6J9Hm0s U@IHeE49x1=C+gOrUc7+(2Rm>XtN;K2 diff --git a/test/val/add1.prg b/test/val/add1.prg deleted file mode 100644 index c0bdb01a211531e1ab95a8bb62320f5c6600ee25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3113 zcmd5;|8Er65r4OPd)_a%bBp9JM@pNAip`f4FktKh`a_#G^iWqN&^D#eAGRt+XB4MN zQ&f~zm1(?J>*PDxswzQIrPYQ#u@-09KeP%zM51bmyi~xeWIMD`EB{cgrUA65IB^nH z*Ll0f*d%{IpM3LX=FR)e?99CPOm4Z2-}s^1ut_mNHw*N$0)11?)0=X^e9&-6*yNk8 zV1BGy{w7=Y!B%{7(IufeDo?SG>&i9u{*|s!;?f6}OKLaue6}x9zNr_uG_BLumGZP6 zv4KQ?sWQ<#BcOOAw!5JhT;i+Q{%L*LEEAhueA0}gz5E!>h|O+3Y37si40kxA2gj+W zhN3wyn4*YogvV}XV)rw8!JOp)(|T|##(NqqS479ZVg|oLi;U=iybQkN|K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S+%HfO}eOC^p;Z9FBn%;cF;>p zc)Zz~xdEm-+T}l_N97@7(foy4GIse}9WpA{WxPxkPd(7U(D6pl4mA3Rt$FEaPJ4PZ z>*hC9g!M_@p*~5e9a=}aL*H`M7)jnX>go`?d-3vQI`66IE-mTouMR1U%Aq*L7CoUV zT5O9;N>;cbqMz$r7tMmv9L+G2j^zn_J4)Cze!{Y$6mBbKXpiQTsu*_IhGXo{oPZHE z+biTty@qWRP8cUoplXQy+k{m1wvADwjU1S}_i z6ZvaEUrS#)23Si!VV=R@U6SXGij9v?Qo>1K0SiM|KrHHGbzF5U2bscki^IBvH))9f zczsw`=Gnuuk(QS^(zlGgbv?aV2veopojLyR*?V<`{mWCU8s^W2D04KKj*{;a>{p|j z37<|09paV_C4Ut><#uL7ww1zd$k&C!5c{VsTha1F@+x3ep)L%u`>4d`KF{CQ=#|>2D*#pN!4W1&c?0+qzYe)}@Bwo` z|0vZcjIRgl#P|DNJoTgASNGEP<0|Rgv2$0~?(Ux4o-aT9m9IXxf9uX2T|Hg7UEN(d zVmun`c^r>~$FoCLkM#0b(yP%BK4ruPN;DFmGWhzJVx#{Tnjnb;5fV>^^EdtP`kZbO lQdXd%LfL@I8W_6VXq2Cdr?oJ=4rrs{G}ydF$g^pV@IUQx^l$(G diff --git a/test/val/add3.o b/test/val/add3.o deleted file mode 100644 index 53a40880f534f9a6ae7b9f30a714459ca72b527d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22855 zcmaKU2Y40NweGB$b7la?xW-mo;u9zKO|uOG+>+}X92fasT_J08xY}Li7#-(aZbSKZmCs^u0IVr!{-lUiIH=@2N-c z|E+8CeU@c?h`+n=_b2?_i@(3)uh$Efbq#-WZOfYZvSrP4EbG%(EDMKL7wiikwyb+T zu&n37fBiR>CE$MszV6?M9Xq!3vx4RQ#s!^#Z9g*Z$@j9dwdA%e8ZArIqo%2NEZuxOA6(f*ZeI#I)z?6jXzFmN6(zw4aSd@HRB`fVKuP?lp{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val/add4.prg b/test/val/add4.prg deleted file mode 100644 index b00f313293bf5322b34fa6052ab7098fb35db783..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3019 zcmd58{cjvcb#`y>JiB}Eyg~lBs4a{{<1{HL&PN-=4~0^QE@DMN^oNwBWs}t55*nbC zHZB5Df%jxA-(gpLq$!nFEAJ`mW)B;FilC@Ul*DU#Z58!?ce5TE*#?WezubZsyWh6xAhsULiK(l%5XT5^ zaLWGCRNfBgV>^UOqV(z1O>tX657eH;UD>pxj?wWYVsBr+Stbz?dy^PZ*=rP|xJzG9 z6r?G_<;6Yx;v>3`LG7Dxqrm8`1Vq?LAh8P!+k(ng2rQ^=O|%#GeEDW=%ircg`5CC} z0rm~qe+-cxs5}d-Gm$HA24>3sYB!4>;*E=KC~P=ETw<)!VpSZ?}Rspv-~2 zrTE+h6lEthb02suT^D7$WmG=eY6Yi(FJV7cOqGgdMl21A(3VRn_ORkeV=W_nV=ZX4 zm-eb-ZCw{T2R{{Rqj$0OO2MO5HA6e%ubbMmzgx9qq$se#<8^iPuR_K;a0V`)ffvqV zpPqFgzxxafN*By2&C6Gp;>7M(E}sBCfB7Wv84KeLrlIy<5pggBwOO&ixO*wPLuJPm zkD6aoZ$S2|1t)#5g}g8Uea4ld-BN00r>WgmY8O+!v=q<8P<|YLWBKxnAmDGoYqP1> zZmS|&ksdCKn#TEDy`4|*&3CuiZG)J;uJhE^y!P{|t*5nU8T&GI(%#Y`(&yy`Pz9g@ z=mKa%gzW>iRvF>Cn|@^ie$_Hz%v<3yj#(2B6UH7;%tz8barKvu!-R1a8LN1@avY+i z;oZ3S8$?FPaPb;MP2nfGT6rB%%{-TOS=h-lBZ!Q(Ro;MbWnvGjwLHUqu9QzeF)%CE>1!hGwLMPjKCDluySFAI=P%0rzZW z8eFJgA=WG5cAmqwD4zwNl+S_L(-c0AN;~-~>_ZG!c3FVo%kJHkH-UXy8BTTT2i}Az zGjLXv-qBb#EtI~)TSa%_@x;vM@nRAHlM;THFGsZluS3*cC>d!ZEvHj332+K+_?_&S zQgrBojqh>11S+TD0;b3B;mgCPcvi$VEn*c;p5{8U6!f_?_Su7hZsIEn0UFn0TmB|A zC`1etDTX~uK~4E&WMiXz68aIIfZ#ar6uYRfSp}DoSfc&%dm@il0WameL!Kn#h5jeWNZunm zWt(90NkwbCkl)))7BM`3a&O9-dTwyeX~fH54r=elXXFah=EcHM%>Sg~M`5!I;!*HO z*F^;_NY+s)Mly>?`F*fyHX~Z4Pyw=3#8dD9P4;#EC5Qc+m_!0@jsxm~mC#(or_A?#r<7cF62qld(gh`30*l?NR${=)P7^Fzsey) zv`+CFRXuHE1B1r9K;PKdNo?KA#&gz#cn0%j70vpj;4q(Lv<|%^+W{+&7=y}rqptPw zOZyLgE?e+4beBy7Kjo0(5RFpfeBP6*DT}XkNxv1{8N-iv-X71g(Gt(O!EAz$Dq?nt zFIjf3Kf0&X%zml)q?(F4Y{M}&H1Eg_YWZ%t(BEy?MsbI+YX_40_`kedwb?SaXv1;X|c!NGTc(d>cifED&7^Be~6l7eVaY6N!76&WE}Zcq1TB0tHM7WHZYYKL$8rUwMa!#ioGCMNjHgpj__~L zdv)~!pWSQ4?SXv}(_2Sg*_>S=N16Vvi&Nsy(!c8}|EH%_bxgROi&M>>*W+sW1Y6sv zHbU#o0%|;@TMWVfd?NJ!3?(8-M3z1p;*a1b r@KZ1eDZdPr15o}wRQ>>c2OEv@pOWd1Fz{z!jfT_U7c4@!E-d^HRo(F& From f82343c4840e5b0a4fd9ac81fd04a7c6642f0831 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 16:44:48 +0100 Subject: [PATCH 02/22] sitest can not work --- test/val/sitest.c | 1591 --------------------------------------------- 1 file changed, 1591 deletions(-) delete mode 100644 test/val/sitest.c diff --git a/test/val/sitest.c b/test/val/sitest.c deleted file mode 100644 index 9570f4989..000000000 --- a/test/val/sitest.c +++ /dev/null @@ -1,1591 +0,0 @@ -/* - !!DESCRIPTION!! C99 WCHAR test - !!ORIGIN!! - !!LICENCE!! public domain -*/ - -/* - sitest -- exercise features of C99 and - - This source code has been placed into the PUBLIC DOMAIN by its author. - - last edit: 1999/11/05 gwyn@arl.mil - - Tries to accommodate pre-C99 versions of . - - Takes advantage of __Q8_* symbols defined by a particular - implementation of , but doesn't require them. - - NOTE: This is not a thorough validation test of the facilities. -*/ - -#define NO_INTERNAL_WCHAR -/*#define STANDALONE*/ - -#include -#include /* for CHAR_BIT */ -#include -#include /* for ptrdiff_t */ -#include -#include - -#if !defined(STANDARD_C99) && !defined(STANDARD_CC65) - -#error "this test checks C99 features, which are not available in the selected standard." - -#else - -#ifdef NO_WCHAR - -#warn "this test checks C99 features, but NO_WCHAR is defined so the test will most definetly fails." - -#endif - -#include /* embeds */ - -#include /* for sig_atomic_t */ - -#if defined(INTMAX_MAX) /* has C99 features */ -#include -#endif - -#include /* test idempotency */ - -#ifdef STANDALONE - -FILE *outfile=NULL; -#define opentest(x) outfile=stdout; -#define closetest(x) - -#else - -#endif - -#if __STDC_VERSION__ >= 199901 -#ifndef __Q8_QT -#define __Q8_QT long long -#endif -#endif - -#ifdef PRIdMAX -#define HAVE_PRIdMAX -#ifndef __Q8_MT -#define __Q8_MT intmax_t -#endif -#else -#ifdef PRIdLEAST64 -#ifndef __Q8_MT -#define __Q8_MT int_least64_t -#endif -#define PRIdMAX PRIdLEAST64 -#else -#ifndef __Q8_MT -#define __Q8_MT long -#endif -#define PRIdMAX "ld" -#endif -#endif - -#ifdef PRIuMAX -#define HAVE_PRIuMAX -#define U__Q8_MT uintmax_t -#else -#ifdef PRIuLEAST64 -#define U__Q8_MT uint_least64_t -#define PRIuMAX PRIuLEAST64 -#else -#define U__Q8_MT unsigned long -#define PRIuMAX "lu" -#endif -#endif - -#define STR_SUB(s) # s -#define STRINGIZE(s) STR_SUB(s) /* extra level to expand argument */ - -#if defined(SCNo32) || defined(PRIo32) -static int32_t int32; -#endif -static int_least16_t intl16; -static uint_least16_t uintl16; -static uint_fast16_t uintf16; -static intmax_t intmax; -static uintmax_t uintmax; - -int -main() { - int status = 0; /* exit status to be returned */ - - - /* features: */ - - printf("CHAR_BIT=%u\n", (unsigned)CHAR_BIT ); - printf("sizeof(char)=%u\n", (unsigned)sizeof(char)); /* s.b. 1 */ - printf("sizeof(short)=%u\n", (unsigned)sizeof(short)); - printf("sizeof(int)=%u\n", (unsigned)sizeof(int)); - printf("sizeof(long)=%u\n", (unsigned)sizeof(long)); -#ifdef __Q8_QT - printf("sizeof(long long)=%u\n", (unsigned)sizeof(__Q8_QT)); -#else - printf("*** long long isn't defined ***\n"); -#endif - printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t)); - printf("sizeof(ptrdiff_t)=%u\n", (unsigned)sizeof(ptrdiff_t)); - printf("sizeof(size_t)=%u\n", (unsigned)sizeof(size_t)); - printf("sizeof(sig_atomic_t)=%u\n", (unsigned)sizeof(sig_atomic_t)); - printf("sizeof(wchar_t)=%u\n", (unsigned)sizeof(wchar_t)); -#if defined(WINT_MAX) || __STDC_VERSION__ >= 199901 - printf("sizeof(wint_t)=%u\n", (unsigned)sizeof(wint_t)); -#else - printf("*** wint_t isn't defined ***\n"); - status = EXIT_FAILURE; -#endif -#ifdef INT8_MAX - printf("sizeof(int8_t)=%u\n", (unsigned)sizeof(int8_t)); - printf("sizeof(uint8_t)=%u\n", (unsigned)sizeof(uint8_t)); -#endif -#ifdef INT9_MAX - printf("sizeof(int9_t)=%u\n", (unsigned)sizeof(int9_t)); - printf("sizeof(uint9_t)=%u\n", (unsigned)sizeof(uint9_t)); -#endif -#ifdef INT12_MAX - printf("sizeof(int12_t)=%u\n", (unsigned)sizeof(int12_t)); - printf("sizeof(uint12_t)=%u\n", (unsigned)sizeof(uint12_t)); -#endif -#ifdef INT16_MAX - printf("sizeof(int16_t)=%u\n", (unsigned)sizeof(int16_t)); - printf("sizeof(uint16_t)=%u\n", (unsigned)sizeof(uint16_t)); -#endif -#ifdef INT18_MAX - printf("sizeof(int18_t)=%u\n", (unsigned)sizeof(int18_t)); - printf("sizeof(uint18_t)=%u\n", (unsigned)sizeof(uint18_t)); -#endif -#ifdef INT24_MAX - printf("sizeof(int24_t)=%u\n", (unsigned)sizeof(int24_t)); - printf("sizeof(uint24_t)=%u\n", (unsigned)sizeof(uint24_t)); -#endif -#ifdef INT32_MAX - printf("sizeof(int32_t)=%u\n", (unsigned)sizeof(int32_t)); - printf("sizeof(uint32_t)=%u\n", (unsigned)sizeof(uint32_t)); -#endif -#ifdef INT36_MAX - printf("sizeof(int36_t)=%u\n", (unsigned)sizeof(int36_t)); - printf("sizeof(uint36_t)=%u\n", (unsigned)sizeof(uint36_t)); -#endif -#ifdef INT40_MAX - printf("sizeof(int40_t)=%u\n", (unsigned)sizeof(int40_t)); - printf("sizeof(uint40_t)=%u\n", (unsigned)sizeof(uint40_t)); -#endif -#ifdef INT48_MAX - printf("sizeof(int48_t)=%u\n", (unsigned)sizeof(int48_t)); - printf("sizeof(uint48_t)=%u\n", (unsigned)sizeof(uint48_t)); -#endif -#ifdef INT60_MAX - printf("sizeof(int60_t)=%u\n", (unsigned)sizeof(int60_t)); - printf("sizeof(uint60_t)=%u\n", (unsigned)sizeof(uint60_t)); -#endif -#ifdef INT64_MAX - printf("sizeof(int64_t)=%u\n", (unsigned)sizeof(int64_t)); - printf("sizeof(uint64_t)=%u\n", (unsigned)sizeof(uint64_t)); -#endif -#ifdef INT72_MAX - printf("sizeof(int72_t)=%u\n", (unsigned)sizeof(int72_t)); - printf("sizeof(uint72_t)=%u\n", (unsigned)sizeof(uint72_t)); -#endif -#ifdef INT128_MAX - printf("sizeof(int128_t)=%u\n", (unsigned)sizeof(int128_t)); - printf("sizeof(uint128_t)=%u\n", (unsigned)sizeof(uint128_t)); -#endif - printf("sizeof(int_least8_t)=%u\n", (unsigned)sizeof(int_least8_t)); - printf("sizeof(uint_least8_t)=%u\n", (unsigned)sizeof(uint_least8_t)); - printf("sizeof(int_least16_t)=%u\n", (unsigned)sizeof(int_least16_t)); - printf("sizeof(uint_least16_t)=%u\n", (unsigned)sizeof(uint_least16_t)); - printf("sizeof(int_least32_t)=%u\n", (unsigned)sizeof(int_least32_t)); - printf("sizeof(uint_least32_t)=%u\n", (unsigned)sizeof(uint_least32_t)); -#ifdef INT_LEAST64_MAX - printf("sizeof(int_least64_t)=%u\n", (unsigned)sizeof(int_least64_t)); - printf("sizeof(uint_least64_t)=%u\n", (unsigned)sizeof(uint_least64_t)); -#else - printf("*** uint_least64_t isn't defined ***\n"); - status = EXIT_FAILURE; -#endif -#ifdef INT_LEAST128_MAX - printf("sizeof(int_least128_t)=%u\n", (unsigned)sizeof(int_least128_t)); - printf("sizeof(uint_least128_t)=%u\n", - (unsigned)sizeof(uint_least128_t)); -#endif - printf("sizeof(int_fast8_t)=%u\n", (unsigned)sizeof(int_fast8_t)); - printf("sizeof(uint_fast8_t)=%u\n", (unsigned)sizeof(uint_fast8_t)); - printf("sizeof(int_fast16_t)=%u\n", (unsigned)sizeof(int_fast16_t)); - printf("sizeof(uint_fast16_t)=%u\n", (unsigned)sizeof(uint_fast16_t)); - printf("sizeof(int_fast32_t)=%u\n", (unsigned)sizeof(int_fast32_t)); - printf("sizeof(uint_fast32_t)=%u\n", (unsigned)sizeof(uint_fast32_t)); -#ifdef INT_FAST64_MAX - printf("sizeof(int_fast64_t)=%u\n", (unsigned)sizeof(int_fast64_t)); - printf("sizeof(uint_fast64_t)=%u\n", (unsigned)sizeof(uint_fast64_t)); -#else - printf("*** int_fast64_t isn't defined ***\n"); - status = EXIT_FAILURE; -#endif -#ifdef INT_FAST128_MAX - printf("sizeof(int_fast128_t)=%u\n", (unsigned)sizeof(int_fast128_t)); - printf("sizeof(uint_fast128_t)=%u\n", (unsigned)sizeof(uint_fast128_t)); -#endif -#if defined(INTPTR_MAX) - printf("sizeof(intptr_t)=%u\n", (unsigned)sizeof(intptr_t)); -#if defined(UINTPTR_MAX) - printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t)); -#else - printf("*** intptr_t is defined but uintptr_t isn't ***\n"); - status = EXIT_FAILURE; -#endif -#elif defined(UINTPTR_MAX) - printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t)); - printf("*** uintptr_t is defined but intptr_t isn't ***\n"); - status = EXIT_FAILURE; -#else - printf("*** neither intptr_t nor uintptr_t is defined ***\n"); - status = EXIT_FAILURE; -#endif -#ifdef INTMAX_MAX - printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t)); - printf("sizeof(uintmax_t)=%u\n", (unsigned)sizeof(uintmax_t)); -#else - printf("*** intmax_t isn't defined ***\n"); - status = EXIT_FAILURE; -#endif - -#ifdef INT8_MAX - printf("INT8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT8_MIN); - printf("INT8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT8_MAX); - printf("UINT8_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT8_MAX); -#endif -#ifdef INT9_MAX - printf("INT9_MIN=%"PRIdMAX"\n", (__Q8_MT)INT9_MIN); - printf("INT9_MAX=%"PRIdMAX"\n", (__Q8_MT)INT9_MAX); - printf("UINT9_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT9_MAX); -#endif -#ifdef INT12_MAX - printf("INT12_MIN=%"PRIdMAX"\n", (__Q8_MT)INT12_MIN); - printf("INT12_MAX=%"PRIdMAX"\n", (__Q8_MT)INT12_MAX); - printf("UINT12_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT12_MAX); -#endif -#ifdef INT16_MAX - printf("INT16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT16_MIN); - printf("INT16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT16_MAX); - printf("UINT16_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT16_MAX); -#endif -#ifdef INT18_MAX - printf("INT18_MIN=%"PRIdMAX"\n", (__Q8_MT)INT18_MIN); - printf("INT18_MAX=%"PRIdMAX"\n", (__Q8_MT)INT18_MAX); - printf("UINT18_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT18_MAX); -#endif -#ifdef INT24_MAX - printf("INT24_MIN=%"PRIdMAX"\n", (__Q8_MT)INT24_MIN); - printf("INT24_MAX=%"PRIdMAX"\n", (__Q8_MT)INT24_MAX); - printf("UINT24_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT24_MAX); -#endif -#ifdef INT32_MAX - printf("INT32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT32_MIN); - printf("INT32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT32_MAX); - printf("UINT32_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT32_MAX); -#endif -#ifdef INT36_MAX - printf("INT36_MIN=%"PRIdMAX"\n", (__Q8_MT)INT36_MIN); - printf("INT36_MAX=%"PRIdMAX"\n", (__Q8_MT)INT36_MAX); - printf("UINT36_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT36_MAX); -#endif -#ifdef INT40_MAX - printf("INT40_MIN=%"PRIdMAX"\n", (__Q8_MT)INT40_MIN); - printf("INT40_MAX=%"PRIdMAX"\n", (__Q8_MT)INT40_MAX); - printf("UINT40_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT40_MAX); -#endif -#ifdef INT48_MAX - printf("INT48_MIN=%"PRIdMAX"\n", (__Q8_MT)INT48_MIN); - printf("INT48_MAX=%"PRIdMAX"\n", (__Q8_MT)INT48_MAX); - printf("UINT48_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT48_MAX); -#endif -#ifdef INT60_MAX - printf("INT60_MIN=%"PRIdMAX"\n", (__Q8_MT)INT60_MIN); - printf("INT60_MAX=%"PRIdMAX"\n", (__Q8_MT)INT60_MAX); - printf("UINT60_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT60_MAX); -#endif -#ifdef INT64_MAX - printf("INT64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT64_MIN); - printf("INT64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT64_MAX); - printf("UINT64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT64_MAX); -#endif -#ifdef INT72_MAX - printf("INT72_MIN=%"PRIdMAX"\n", (__Q8_MT)INT72_MIN); - printf("INT72_MAX=%"PRIdMAX"\n", (__Q8_MT)INT72_MAX); - printf("UINT72_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT72_MAX); -#endif -#ifdef INT128_MAX - printf("INT128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT128_MIN); - printf("INT128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT128_MAX); - printf("UINT128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT128_MAX); -#endif - printf("INT_LEAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MIN); - printf("INT_LEAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MAX); - printf("UINT_LEAST8_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_LEAST8_MAX); - printf("INT_LEAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MIN); - printf("INT_LEAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MAX); - printf("UINT_LEAST16_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_LEAST16_MAX); - printf("INT_LEAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MIN); - printf("INT_LEAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MAX); - printf("UINT_LEAST32_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_LEAST32_MAX); -#ifdef INT_LEAST64_MAX - printf("INT_LEAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MIN); - printf("INT_LEAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MAX); - printf("UINT_LEAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST64_MAX); -#endif -#ifdef INT_LEAST128_MAX - printf("INT_LEAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MIN); - printf("INT_LEAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MAX); - printf("UINT_LEAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST128_MAX); -#endif - printf("INT_FAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MIN); - printf("INT_FAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MAX); - printf("UINT_FAST8_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_FAST8_MAX); - printf("INT_FAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MIN); - printf("INT_FAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MAX); - printf("UINT_FAST16_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_FAST16_MAX); - printf("INT_FAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MIN); - printf("INT_FAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MAX); - printf("UINT_FAST32_MAX=%"PRIuMAX"\n", - (U__Q8_MT)UINT_FAST32_MAX); -#ifdef INT_FAST64_MAX - printf("INT_FAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MIN); - printf("INT_FAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MAX); - printf("UINT_FAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST64_MAX); -#endif -#ifdef INT_FAST128_MAX - printf("INT_FAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MIN); - printf("INT_FAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MAX); - printf("UINT_FAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST128_MAX); -#endif -#ifdef INTPTR_MAX - printf("INTPTR_MIN=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MIN); - printf("INTPTR_MAX=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MAX); -#endif -#ifdef UINTPTR_MAX - printf("UINTPTR_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTPTR_MAX); -#endif -#ifdef INTMAX_MAX - printf("INTMAX_MIN=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MIN); - printf("INTMAX_MAX=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MAX); - printf("UINTMAX_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTMAX_MAX); -#endif -#ifdef PTRDIFF_MAX - printf("PTRDIFF_MIN=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MIN); - printf("PTRDIFF_MAX=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MAX); -#endif -#ifdef SIG_ATOMIC_MAX -#if SIG_ATOMIC_MIN < 0 - printf("SIG_ATOMIC_MIN=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MIN); - printf("SIG_ATOMIC_MAX=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MAX); -#else - printf("SIG_ATOMIC_MIN=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MIN); - printf("SIG_ATOMIC_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MAX); -#endif -#endif -#ifdef SIZE_MAX - printf("SIZE_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIZE_MAX); -#endif - -#ifdef WCHAR_MAX -#if WCHAR_MIN < 0 - printf("WCHAR_MIN=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MIN); - printf("WCHAR_MAX=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MAX); -#else - printf("WCHAR_MIN=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MIN); - printf("WCHAR_MAX=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MAX); -#endif -#endif -#ifdef WINT_MAX -#if WINT_MIN < 0 - printf("WINT_MIN=%"PRIdMAX"\n", (__Q8_MT)WINT_MIN); - printf("WINT_MAX=%"PRIdMAX"\n", (__Q8_MT)WINT_MAX); -#else - printf("WINT_MIN=%"PRIuMAX"\n", (U__Q8_MT)WINT_MIN); - printf("WINT_MAX=%"PRIuMAX"\n", (U__Q8_MT)WINT_MAX); -#endif -#endif - - /* - 7.18.4 Macros for integer constants - */ - - /* INTn_C for n=8 and 16 were at one point unimplementable - on most platforms, so they're treated as "optional": */ -#ifdef INT8_C - if ( INT8_C(-123) != -123 ) - printf("*** INT8_C(-123) produced %"PRIdMAX" ***\n", - (__Q8_MT)INT8_C(-123) - ); - if ( UINT8_C(123) != 123 ) - printf("*** UINT8_C(123) produced %"PRIuMAX" ***\n", - (U__Q8_MT)UINT8_C(123) - ); -#endif -#ifdef INT16_C - if ( INT16_C(-12345) != -12345 ) - printf("*** INT16_C(-12345) produced %"PRIdMAX" ***\n", - (__Q8_MT)INT16_C(-12345) - ); - if ( UINT16_C(12345) != 12345 ) - printf("*** UINT16_C(12345) produced %"PRIuMAX" ***\n", - (U__Q8_MT)UINT16_C(12345) - ); -#endif - if ( INT32_C(-123456789) != -123456789 ) - printf("*** INT32_C(-123456789) produced %"PRIdMAX" ***\n", - (__Q8_MT)INT32_C(-123456789) - ); - if ( UINT32_C(123456789) != 123456789 ) - printf("*** UINT32_C(123456789) produced %"PRIuMAX" ***\n", - (U__Q8_MT)UINT32_C(123456789) - ); -#ifdef INT_LEAST64_MAX - if ( INT64_C(-1234567890123456789) != -1234567890123456789 ) - printf("*** INT64_C(-1234567890123456789) produced %"PRIdMAX - " ***\n", - (__Q8_MT)INT64_C(-1234567890123456789) - ); - if ( UINT64_C(1234567890123456789) != 1234567890123456789 ) - printf("*** UINT64_C(1234567890123456789) produced %"PRIuMAX - " ***\n", - (U__Q8_MT)UINT64_C(1234567890123456789) - ); -#endif -#ifdef INTMAX_MAX - if ( INTMAX_C(-1234567890123456789) != -1234567890123456789 ) - printf("*** INTMAX_C(-1234567890123456789) produced %"PRIdMAX - " ***\n", - (__Q8_MT)INTMAX_C(-1234567890123456789) - ); - if ( UINTMAX_C(1234567890123456789) != 1234567890123456789 ) - printf("*** UINTMAX_C(1234567890123456789) produced %"PRIuMAX - " ***\n", - (U__Q8_MT)UINTMAX_C(1234567890123456789) - ); -#endif - - /* features: */ - -#if __STDC_VERSION__ >= 199901 - printf("sizeof(imaxdiv_t)=%u\n", (unsigned)sizeof(imaxdiv_t)); -#endif - - /* - 7.8.1 Macros for format specifiers - */ - - { - /* scanf these strings */ - static const char in_dn[] = "Z119bZ"; - static const char in_dmo[] = "Z-0119bZ"; - static const char in_dspx[] = "Z \t\n +0X119bZ"; - static const char in_dsmx[] = "Z \t\n -0x119bZ"; - static const char in_dsn[] = "Z \t\n 119bZ"; - static const char in_dp[] = "Z+119bZ"; - static const char in_dpx[] = "Z+0X119bz"; - - /* sprintf into this */ - static char buffer[1024]; - -#if 1 - -#define SCAN(buf,fs,var,exp) if ( sscanf(buf, "Z%" fs, &var) != 1 ) \ - { \ - printf("***%s=",fs, STR_SUB(fs) \ - " failed ***\n" \ - ); \ - status = EXIT_FAILURE; \ - } \ - else if ( var != (exp) ) \ - { \ - printf("***%s=",fs, STR_SUB(fs) \ - " should be: " STR_SUB(exp) \ - ", was: %" fs " ***\n", var \ - ); \ - status = EXIT_FAILURE; \ - } \ - else /* for trailing semicolon */ - -#define PRINT(fs,var,exp) if ( sprintf(buffer, "%" fs, var ) <= 0 ) \ - { \ - printf("***%s=",fs, STR_SUB(fs) \ - " failed ***\n" \ - ); \ - status = EXIT_FAILURE; \ - } \ - else if ( strcmp(buffer, STR_SUB(exp)) != 0 ) \ - { \ - printf("***%s=",fs, STR_SUB(fs) \ - " should be: " STR_SUB(exp) \ - ", was: %s ***\n", buffer \ - ); \ - status = EXIT_FAILURE; \ - } \ - else /* for trailing semicolon */ - -#else - -#define SCAN(buf,fs,var,exp) -#define PRINT(fs,var,exp) - -#endif - -#ifdef SCNo32 - - SCAN(in_dn, SCNo32, int32, 9); - -#endif -#ifdef PRIo32 - PRINT(PRIo32, int32, 11); -#endif - SCAN(in_dmo, SCNiLEAST16, intl16, -9); - SCAN(in_dspx, SCNdLEAST16, intl16, 0); - SCAN(in_dsmx, SCNiLEAST16, intl16, -4507); - PRINT(PRIdLEAST16, intl16, -4507); - PRINT(PRIiLEAST16, intl16, -4507); - SCAN(in_dsn, SCNxLEAST16, uintl16, 4507); - PRINT(PRIoLEAST16, uintl16, 10633); - PRINT(PRIuLEAST16, uintl16, 4507); - PRINT(PRIxLEAST16, uintl16, 119b); - PRINT(PRIXLEAST16, uintl16, 119B); - SCAN(in_dp, SCNxFAST16, uintf16, 4507); - PRINT(PRIxFAST16, uintf16, 119b); -#ifdef SCNdMAX - SCAN(in_dp, SCNdMAX, intmax, 119); -#endif -#ifdef PRIiMAX - PRINT(PRIiMAX, intmax, 119); -#endif -#ifdef SCNoMAX - SCAN(in_dpx, SCNoMAX, uintmax, 0); -#endif -#ifdef PRIxMAX - PRINT(PRIxMAX, uintmax, 0); -#endif - /* Obviously there should be a much larger battery of such tests. */ - } - -#if defined(INTMAX_MAX) /* has C99 features */ - /* - 7.8.2 Functions for greatest-width integer types - */ - - { - static struct - { - intmax_t input; - intmax_t expect; - } abs_data[] = - { -#ifdef INT8_MAX - { INT8_MAX, INT8_MAX, }, - { -INT8_MAX, INT8_MAX, }, - { UINT8_MAX, UINT8_MAX, }, -#endif - -#if 0 - -#ifdef INT16_MAX - { INT16_MAX, INT16_MAX, }, - { -INT16_MAX, INT16_MAX, }, - { UINT16_MAX, UINT16_MAX, }, -#endif -#ifdef INT32_MAX - { INT32_MAX, INT32_MAX, }, - { -INT32_MAX, INT32_MAX, }, -#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ - { UINT32_MAX, UINT32_MAX, }, -#endif -#endif -#ifdef INT64_MAX - { INT64_MAX, INT64_MAX, }, - { -INT64_MAX, INT64_MAX, }, -#endif - { INT_LEAST8_MAX, INT_LEAST8_MAX, }, - { -INT_LEAST8_MAX, INT_LEAST8_MAX, }, - { UINT_LEAST8_MAX, UINT_LEAST8_MAX, }, - { INT_LEAST16_MAX, INT_LEAST16_MAX, }, - { -INT_LEAST16_MAX, INT_LEAST16_MAX, }, - { UINT_LEAST16_MAX, UINT_LEAST16_MAX, }, - { INT_LEAST32_MAX, INT_LEAST32_MAX, }, - { -INT_LEAST32_MAX, INT_LEAST32_MAX, }, -#ifdef INT_LEAST64_MAX - { UINT_LEAST32_MAX, UINT_LEAST32_MAX, }, - { INT_LEAST64_MAX, INT_LEAST64_MAX, }, - { -INT_LEAST64_MAX, INT_LEAST64_MAX, }, -#endif - { INT_FAST8_MAX, INT_FAST8_MAX, }, - { -INT_FAST8_MAX, INT_FAST8_MAX, }, - { UINT_FAST8_MAX, UINT_FAST8_MAX, }, - { INT_FAST16_MAX, INT_FAST16_MAX, }, - { -INT_FAST16_MAX, INT_FAST16_MAX, }, - { UINT_FAST16_MAX, UINT_FAST16_MAX, }, - { INT_FAST32_MAX, INT_FAST32_MAX, }, - { -INT_FAST32_MAX, INT_FAST32_MAX, }, -#ifdef INT_FAST64_MAX - { UINT_FAST32_MAX, UINT_FAST32_MAX, }, - { INT_FAST64_MAX, INT_FAST64_MAX, }, - { -INT_FAST64_MAX, INT_FAST64_MAX, }, -#endif -#ifdef INTPTR_MAX - { INTPTR_MAX, INTPTR_MAX, }, - { -INTPTR_MAX, INTPTR_MAX, }, -#endif -#ifdef UINTPTR_MAX - { UINTPTR_MAX, UINTPTR_MAX, }, -#endif - { INTMAX_MAX, INTMAX_MAX, }, -#ifdef PTRDIFF_MAX - { PTRDIFF_MAX, PTRDIFF_MAX, }, -#endif -#ifdef SIG_ATOMIC_MAX - { SIG_ATOMIC_MAX, SIG_ATOMIC_MAX, }, -#if SIG_ATOMIC_MIN < 0 - { -SIG_ATOMIC_MAX, SIG_ATOMIC_MAX, }, -#endif -#endif -#ifdef SIZE_MAX - { SIZE_MAX, SIZE_MAX, }, -#endif -#ifdef WCHAR_MAX - { WCHAR_MAX, WCHAR_MAX, }, -#if WCHAR_MIN < 0 - { -WCHAR_MAX, WCHAR_MAX, }, -#endif -#endif -#ifdef WINT_MAX - { WINT_MAX, WINT_MAX, }, -#if WINT_MIN < 0 - { -WINT_MAX, WINT_MAX, }, -#endif -#endif - { 127, 127, }, - { -127, 127, }, - { 128, 128, }, - { -127-1, 128, }, - { 255, 255, }, - { -256+1, 255, }, - { 256, 256, }, - { -256, 256, }, - { 32767, 32767, }, - { -32767, 32767, }, - { 32768, 32768, }, - { -32767-1, 32768, }, - { 65535, 65535, }, - { -65536+1, 65535, }, - { 65536, 65536, }, - { -65536, 65536, }, - { 2147483647, 2147483647, }, - { -2147483647, 2147483647, }, - { 2147483648, 2147483648, }, - { -2147483647-1, 2147483648, }, -#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ - { 4294967295, 4294967295, }, - { -4294967296+1, 4294967295, }, - { 4294967296, 4294967296, }, - { -4294967296, 4294967296, }, - { 9223372036854775807, 9223372036854775807, }, - { -9223372036854775807, 9223372036854775807, }, - { 1234567890123456789, 1234567890123456789, }, - { -1234567890123456789, 1234567890123456789, }, -#endif - { 1, 1, }, - { -1, 1, }, - { 2, 2, }, - { -2, 2, }, - { 10, 10, }, - { -10, 10, }, - { 16, 16, }, - { -16, 16, }, -#endif - /* Other test cases can be added here. */ - { 0, 0 /* terminates the list */ }, - }, *adp = abs_data; - - do { - if ( (intmax = imaxabs(adp->input)) != adp->expect ) - { - printf("*** imaxabs(%"PRIdMAX") failed; should be: %" - PRIdMAX", was: %"PRIdMAX" ***\n", - adp->input, adp->expect, intmax - ); - status = EXIT_FAILURE; - } -// } while ( adp++->input != 0 ); - } while ( (adp++)->input != 0 ); - } - - { - imaxdiv_t result; - static struct - { - intmax_t numer; - intmax_t denom; - intmax_t exp_quot; - intmax_t exp_rem; - } div_data[] = - { - { 0, 1, 0, 0, }, -#if 0 - { 0, -1, 0, 0, }, - { 0, 2, 0, 0, }, - { 0, -2, 0, 0, }, - { 0, 5, 0, 0, }, - { 0, -5, 0, 0, }, - { 1, 1, 1, 0, }, - { 1, -1, -1, 0, }, - { 1, 2, 0, 1, }, - { 1, -2, 0, 1, }, - { 1, 5, 0, 1, }, - { 1, -5, 0, 1, }, - { -1, 1, -1, 0, }, - { -1, -1, 1, 0, }, - { -1, 2, 0, -1, }, - { -1, -2, 0, -1, }, - { -1, 5, 0, -1, }, - { -1, -5, 0, -1, }, - { 2, 1, 2, 0, }, - { 2, -1, -2, 0, }, - { 2, 2, 1, 0, }, - { 2, -2, -1, 0, }, - { 2, 5, 0, 2, }, - { 2, -5, 0, 2, }, - { -2, 1, -2, 0, }, - { -2, -1, 2, 0, }, - { -2, 2, -1, 0, }, - { -2, -2, 1, 0, }, - { -2, 5, 0, -2, }, - { -2, -5, 0, -2, }, - { 17, 5, 3, 2, }, - { -17, -5, 3, -2, }, - { 17, -5, -3, 2, }, - { -17, 5, -3, -2, }, - { 2147483647, 1, 2147483647, 0, }, - { -2147483647, 1, -2147483647, 0, }, - { 2147483648, 1, 2147483648, 0, }, - { -2147483647-1, 1, -2147483647-1, 0, }, - { 2147483647, 2, 1073741823, 1, }, - { -2147483647, 2, -1073741823, -1, }, - { 2147483648, 2, 1073741824, 0, }, - { -2147483647-1, 2, -1073741824, 0, }, -#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ - { 4294967295, 1, 4294967295, 0, }, - { -4294967296+1, 1, -4294967296+1, 0, }, - { 4294967296, 1, 4294967296, 0, }, - { -4294967296, 1, -4294967296, 0, }, - { 4294967295, -1, -4294967296+1, 0, }, - { -4294967296+1, -1, 4294967295, 0, }, - { 4294967296, -1, -4294967296, 0, }, - { -4294967296, -1, 4294967296, 0, }, - { 4294967295, 2, 2147483647, 1, }, - { -4294967296+1, 2, -2147483647, -1, }, - { 4294967296, 2, 2147483648, 0, }, - { -4294967296, 2, -2147483647-1, 0, }, - { 4294967295, 2147483647, 2, 1, }, - { -4294967296+1, 2147483647, -2, -1, }, - { 4294967296, 2147483647, 2, 2, }, - { -4294967296, 2147483647, -2, -2, }, - { 4294967295, -2147483647, -2, 1, }, - { -4294967296+1, -2147483647, 2, -1, }, - { 4294967296, -2147483647, -2, 2, }, - { -4294967296, -2147483647, 2, -2, }, - { 4294967295, 2147483648, 1, 2147483647, }, - { -4294967296+1, 2147483648, -1, -2147483647, }, - { 4294967296, 2147483648, 2, 0, }, - { -4294967296, 2147483648, -2, 0, }, - { 4294967295, -2147483647-1, -1, 2147483647, }, - { -4294967296+1, -2147483647-1, 1, -2147483647,}, - { 4294967296, -2147483647-1, -2, 0, }, - { -4294967296, -2147483647-1, 2, 0, }, - { 9223372036854775807, 1, 9223372036854775807, 0, }, - { -9223372036854775807, 1, -9223372036854775807, 0, }, - { 9223372036854775807, 2, 4611686018427387903, 1, }, - { -9223372036854775807, 2, -4611686018427387903, -1, }, -#endif -#endif - /* There should be a much larger battery of such tests. */ - { 0, 0, 0, 0 }, /* 0 denom terminates the list */ - }, *ddp; - -#if 0 - for ( ddp = div_data; ddp->denom != 0; ++ddp ) - if ( (result = imaxdiv(ddp->numer, ddp->denom)).quot - != ddp->exp_quot || result.rem != ddp->exp_rem - ) { -// printf("*** imaxdiv(%"PRIdMAX",%"PRIdMAX -// ") failed; should be: (%"PRIdMAX",%"PRIdMAX -// "), was: (%"PRIdMAX",%"PRIdMAX") ***\n", -// ddp->numer, ddp->denom, ddp->exp_quot, -// ddp->exp_rem, result.quot, result.rem -// ); - printf("err:imaxdiv(%"PRIdMAX",%"PRIdMAX - ") = (%"PRIdMAX",%"PRIdMAX - "), is: (%"PRIdMAX",%"PRIdMAX")\n", - ddp->numer, ddp->denom, ddp->exp_quot, - ddp->exp_rem, result.quot, result.rem - ); - status = EXIT_FAILURE; - } -#endif - } - - { - char *endptr; - wchar_t *wendptr; - static char saved[64]; /* holds copy of input string */ - static wchar_t wnptr[64]; /* holds wide copy of test string */ - static int warned; /* "warned for null endptr" flag */ - register int i; - static struct - { - char * nptr; - int base; - intmax_t exp_val; - int exp_len; - } str_data[] = - { - { "", 0, 0, 0, }, - { "", 2, 0, 0, }, - { "", 8, 0, 0, }, - { "", 9, 0, 0, }, - { "", 10, 0, 0, }, - { "", 16, 0, 0, }, - { "", 36, 0, 0, }, - { "0", 0, 0, 1, }, - { "0", 2, 0, 1, }, - { "0", 8, 0, 1, }, - { "0", 9, 0, 1, }, - { "0", 10, 0, 1, }, - { "0", 16, 0, 1, }, - { "0", 36, 0, 1, }, - { "+0", 0, 0, 2, }, - { "+0", 2, 0, 2, }, - { "+0", 8, 0, 2, }, - { "+0", 9, 0, 2, }, - { "+0", 10, 0, 2, }, - { "+0", 16, 0, 2, }, - { "+0", 36, 0, 2, }, - { "-0", 0, 0, 2, }, - { "-0", 2, 0, 2, }, - { "-0", 8, 0, 2, }, - { "-0", 9, 0, 2, }, - { "-0", 10, 0, 2, }, - { "-0", 16, 0, 2, }, - { "-0", 36, 0, 2, }, - { "Inf", 0, 0, 0, }, - { "Inf", 2, 0, 0, }, - { "Inf", 8, 0, 0, }, - { "Inf", 9, 0, 0, }, - { "Inf", 10, 0, 0, }, - { "Inf", 16, 0, 0, }, - { "Inf", 36, 24171, 3, }, - { "+Inf", 0, 0, 0, }, - { "+Inf", 2, 0, 0, }, - { "+Inf", 8, 0, 0, }, - { "+Inf", 9, 0, 0, }, - { "+Inf", 10, 0, 0, }, - { "+Inf", 16, 0, 0, }, - { "+Inf", 36, 24171, 4, }, - { "-Inf", 0, 0, 0, }, - { "-Inf", 2, 0, 0, }, - { "-Inf", 8, 0, 0, }, - { "-Inf", 9, 0, 0, }, - { "-Inf", 10, 0, 0, }, - { "-Inf", 16, 0, 0, }, - { "-Inf", 36, -24171, 4, }, - { "inf", 0, 0, 0, }, - { "inf", 2, 0, 0, }, - { "inf", 8, 0, 0, }, - { "inf", 9, 0, 0, }, - { "inf", 10, 0, 0, }, - { "inf", 16, 0, 0, }, - { "inf", 36, 24171, 3, }, - { "+inf", 0, 0, 0, }, - { "+inf", 2, 0, 0, }, - { "+inf", 8, 0, 0, }, - { "+inf", 9, 0, 0, }, - { "+inf", 10, 0, 0, }, - { "+inf", 16, 0, 0, }, - { "+inf", 36, 24171, 4, }, - { "-inf", 0, 0, 0, }, - { "-inf", 2, 0, 0, }, - { "-inf", 8, 0, 0, }, - { "-inf", 9, 0, 0, }, - { "-inf", 10, 0, 0, }, - { "-inf", 16, 0, 0, }, - { "-inf", 36, -24171, 4, }, - { "119b8Z", 0, 119, 3, }, - { "119bZ", 0, 119, 3, }, - { "-0119bZ", 0, -9, 4, }, - { " \t\n 0X119bZ", 0, 4507, 10, }, - { " \t\n +0X119bZ", 0, 4507, 11, }, - { " \t\n -0x119bZ", 0, -4507, 11, }, - { " \t\n 119bZ", 0, 119, 7, }, - { "+119bZ", 0, 119, 4, }, - { "+0X119bz", 0, 4507, 7, }, - { "119b8Z", 2, 3, 2, }, - { "119bZ", 2, 3, 2, }, - { "-0119bZ", 2, -3, 4, }, - { " \t\n 0X119bZ", 2, 0, 5, }, - { " \t\n +0X119bZ", 2, 0, 6, }, - { " \t\n -0x119bZ", 2, 0, 6, }, - { " \t\n 119bZ", 2, 3, 6, }, - { "+119bZ", 2, 3, 3, }, - { "+0X119bz", 2, 0, 2, }, - { "119b8Z", 8, 9, 2, }, - { "119bZ", 8, 9, 2, }, - { "-0119bZ", 8, -9, 4, }, - { " \t\n 0X119bZ", 8, 0, 5, }, - { " \t\n +0X119bZ", 8, 0, 6, }, - { " \t\n -0x119bZ", 8, 0, 6, }, - { " \t\n 119bZ", 8, 9, 6, }, - { "+119bZ", 8, 9, 3, }, - { "+0X119bz", 8, 0, 2, }, - { "119b8Z", 9, 10, 2, }, - { "119bZ", 9, 10, 2, }, - { "-0119bZ", 9, -10, 4, }, - { " \t\n 0X119bZ", 9, 0, 5, }, - { " \t\n +0X119bZ", 9, 0, 6, }, - { " \t\n -0x119bZ", 9, 0, 6, }, - { " \t\n 119bZ", 9, 10, 6, }, - { "+119bZ", 9, 10, 3, }, - { "+0X119bz", 9, 0, 2, }, - { "119b8Z", 10, 119, 3, }, - { "119bZ", 10, 119, 3, }, - { "-0119bZ", 10, -119, 5, }, - { " \t\n 0X119bZ", 10, 0, 5, }, - { " \t\n +0X119bZ", 10, 0, 6, }, - { " \t\n -0x119bZ", 10, 0, 6, }, - { " \t\n 119bZ", 10, 119, 7, }, - { "+119bZ", 10, 119, 4, }, - { "+0X119bz", 10, 0, 2, }, - { "119b8Z", 16, 72120, 5, }, - { "119bZ", 16, 4507, 4, }, - { "-0119bZ", 16, -4507, 6, }, - { " \t\n 0X119bZ", 16, 4507, 10, }, - { " \t\n +0X119bZ", 16, 4507, 11, }, - { " \t\n -0x119bZ", 16, -4507, 11, }, - { " \t\n 119bZ", 16, 4507,8, }, - { "+119bZ", 16, 4507, 5, }, - { "+0X119bz", 16, 4507, 7, }, - { "119b8Z", 36, 62580275, 6, }, - { "119bZ", 36, 1738367, 5, }, - { "-0119bZ", 36, -1738367, 7, }, - { " \t\n 0X119bZ", 36, 1997122175, 11, }, - { " \t\n +0X119bZ", 36, 1997122175, 12, }, - { " \t\n -0x119bZ", 36, -1997122175, 12, }, - { " \t\n 119bZ", 36, 1738367, 9, }, - { "+119bZ", 36, 1738367, 6, }, - { "+0X119bz", 36, 1997122175, 8, }, - /* There should be a much larger battery of such tests. */ - { "127", 0, 127, 3, }, - { "-127", 0, -127, 4, }, - { "128", 0, 128, 3, }, - { "-128", 0, -127-1, 4, }, - { "255", 0, 255, 3, }, - { "-255", 0, -255, 4, }, - { "256", 0, 256, 3, }, - { "-256", 0, -255-1, 4, }, - { "32767", 0, 32767, 5, }, - { "-32767", 0, -32767, 6, }, - { "32768", 0, 32768, 5, }, - { "-32768", 0, -32767-1, 6, }, - { "65535", 0, 65535, 5, }, - { "-65535", 0, -65536+1, 6, }, - { "65536", 0, 65536, 5, }, - { "-65536", 0, -65536, 6, }, - { "2147483647", 0, 2147483647, 10, }, - { "-2147483647", 0, -2147483647, 11, }, - { "2147483648", 0, 2147483648, 10, }, - { "-2147483648", 0, -2147483647-1, 11, }, - { "4294967295", 0, 4294967295, 10, }, - { "-4294967295", 0, -4294967296+1, 11, }, - { "4294967296", 0, 4294967296, 10, }, - { "-4294967296", 0, -4294967296, 11, }, - { "9223372036854775807", 0, 9223372036854775807, 19, }, - { "-9223372036854775807", 0, -9223372036854775807, 20, }, - { "1234567890123456789", 0, 1234567890123456789, 19, }, - { "-1234567890123456789", 0, -1234567890123456789, 20, }, - { "1", 0, 1, 1, }, - { "-1", 0, -1, 2, }, - { "2", 0, 2, 1, }, - { "-2", 0, -2, 2, }, - { "10", 0, 10, 2, }, - { "-10", 0, -10, 3, }, - { "16", 0, 16, 2, }, - { "-16", 0, -16, 3, }, - /* Other test cases can be added here. */ - { NULL, 0, 0, 0 }, /* terminates the list */ - }, *sdp; - - for ( sdp = str_data; sdp->nptr != NULL ; ++sdp ) - { - /* - 7.8.2.3 The strtoimax and strtoumax functions - */ - - strcpy(saved, sdp->nptr); - - errno = 0; /* shouldn't be changed */ - - if ( (intmax = strtoimax(sdp->nptr, &endptr, sdp->base)) - != sdp->exp_val - ) { - int save = errno; - - printf("*** strtoimax(%s,,%d) failed; should be: %" - PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, - sdp->base, sdp->exp_val, intmax - ); - status = EXIT_FAILURE; - errno = save; - } - else if ( endptr != sdp->nptr + sdp->exp_len ) - { - int save = errno; - - printf("*** strtoimax(%s,,%d) returned wrong endptr" - " ***\n", sdp->nptr, sdp->base - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - printf("*** strtoimax modified errno ***\n"); - status = EXIT_FAILURE; - } - - if ( strcmp(sdp->nptr, saved) != 0 ) - { - printf("*** strtoimax modified its input ***\n"); - status = EXIT_FAILURE; - strcpy(saved, sdp->nptr); - } - - if ( sdp->exp_val >= 0 ) /* else some sign extension */ - { - errno = 0; /* shouldn't be changed */ - - if ( (uintmax = strtoumax(sdp->nptr, &endptr, sdp->base - ) - ) != sdp->exp_val - ) { - int save = errno; - - printf("*** strtoumax(%s,,%d) failed; " - "should be: %"PRIuMAX", was: %"PRIuMAX - " ***\n", sdp->nptr, sdp->base, - sdp->exp_val, uintmax - ); - status = EXIT_FAILURE; - errno = save; - } - else if ( endptr != sdp->nptr + sdp->exp_len ) - { - int save = errno; - - printf("*** strtoumax(%s,,%d) returned wrong " - "endptr ***\n", sdp->nptr, sdp->base - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - printf("*** strtoumax modified errno ***\n"); - status = EXIT_FAILURE; - } - - if ( strcmp(sdp->nptr, saved) != 0 ) - { - printf("*** strtoumax" - " modified its input ***\n" - ); - status = EXIT_FAILURE; - strcpy(saved, sdp->nptr); - } - } - - /* tests for null endptr */ - -#define WARN() if (!warned) warned = 1, printf("*** Using null endptr: ***\n") - - warned = 0; - errno = 0; /* shouldn't be changed */ - - if ( (intmax = strtoimax(sdp->nptr, (char **)NULL, sdp->base)) - != sdp->exp_val - ) { - int save = errno; - - WARN(); - printf("*** strtoimax(%s,NULL,%d) failed; " - "should be: %"PRIdMAX", was: %"PRIdMAX" ***\n", - sdp->nptr, sdp->base, sdp->exp_val, intmax - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - WARN(); - printf("*** strtoimax modified errno ***\n"); - status = EXIT_FAILURE; - } - - if ( strcmp(sdp->nptr, saved) != 0 ) - { - WARN(); - printf("*** strtoimax modified its input ***\n"); - status = EXIT_FAILURE; - strcpy(saved, sdp->nptr); - } - - if ( sdp->exp_val >= 0 ) /* else some sign extension */ - { - errno = 0; /* shouldn't be changed */ - - if ( (uintmax = strtoumax(sdp->nptr, (char **)NULL, - sdp->base - ) - ) != sdp->exp_val - ) { - int save = errno; - - WARN(); - printf("*** strtoumax(%s,NULL,%d) failed; " - "should be: %"PRIuMAX", was: %"PRIuMAX - " ***\n", sdp->nptr, sdp->base, - sdp->exp_val, uintmax - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - WARN(); - printf("*** strtoumax modified errno ***\n"); - status = EXIT_FAILURE; - } - - if ( strcmp(sdp->nptr, saved) != 0 ) - { - WARN(); - printf("*** strtoumax" - " modified its input ***\n" - ); - status = EXIT_FAILURE; - strcpy(saved, sdp->nptr); - } - } - - /* - 7.8.2.4 The wcstoimax and wcstoumax functions - */ - - for ( i = 0; i < 64; ++i ) - if ( (wnptr[i] = sdp->nptr[i]) == '\0' ) - break; - - errno = 0; /* shouldn't be changed */ - - if ( (intmax = wcstoimax(wnptr, &wendptr, sdp->base)) - != sdp->exp_val - ) { - int save = errno; - - printf("*** wcstoimax(%s,,%d) failed; should be: %" - PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, - sdp->base, sdp->exp_val, intmax - ); - status = EXIT_FAILURE; - errno = save; - } - else if ( wendptr != wnptr + sdp->exp_len ) - { - int save = errno; - - printf("*** wcstoimax(%s,,%d) returned wrong endptr" - " ***\n", sdp->nptr, sdp->base - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - printf("*** wcstoimax modified errno ***\n"); - status = EXIT_FAILURE; - } - - for ( i = 0; i < 64; ++i ) - if ( wnptr[i] != sdp->nptr[i] ) - { - printf("*** wcstoimax modified its input ***\n" - ); - status = EXIT_FAILURE; - - for ( ; i < 64; ++i ) - if ( (wnptr[i] = sdp->nptr[i]) == '\0' ) - break; - - break; - } - else if ( wnptr[i] == '\0' ) - break; - - if ( sdp->exp_val >= 0 ) /* else some sign extension */ - { - errno = 0; /* shouldn't be changed */ - - if ( (uintmax = wcstoumax(wnptr, &wendptr, sdp->base) - ) != sdp->exp_val - ) { - int save = errno; - - printf("*** wcstoumax(%s,,%d) failed; " - "should be: %"PRIuMAX", was: %"PRIuMAX - " ***\n", sdp->nptr, sdp->base, - sdp->exp_val, uintmax - ); - status = EXIT_FAILURE; - errno = save; - } - else if ( wendptr != wnptr + sdp->exp_len ) - { - int save = errno; - - printf("*** wcstoumax(%s,,%d) returned wrong " - "endptr ***\n", sdp->nptr, sdp->base - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - printf("*** wcstoumax modified errno ***\n"); - status = EXIT_FAILURE; - } - - for ( i = 0; i < 64; ++i ) - if ( wnptr[i] != sdp->nptr[i] ) - { - printf("*** wcstoumax" - " modified its input ***\n" - ); - status = EXIT_FAILURE; - - for ( ; i < 64; ++i ) - if ( (wnptr[i] = sdp->nptr[i]) - == '\0' - ) - break; - - break; - } - else if ( wnptr[i] == '\0' ) - break; - } - - /* tests for null endptr */ - - warned = 0; - errno = 0; /* shouldn't be changed */ - - if ( (intmax = wcstoimax(wnptr, (wchar_t **)NULL, sdp->base)) - != sdp->exp_val - ) { - int save = errno; - - WARN(); - printf("*** wcstoimax(%s,NULL,%d) failed; should be: %" - PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, - sdp->base, sdp->exp_val, intmax - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - WARN(); - printf("*** wcstoimax modified errno ***\n"); - status = EXIT_FAILURE; - } - - for ( i = 0; i < 64; ++i ) - if ( wnptr[i] != sdp->nptr[i] ) - { - WARN(); - printf("*** wcstoimax modified its input ***\n" - ); - status = EXIT_FAILURE; - - for ( ; i < 64; ++i ) - if ( (wnptr[i] = sdp->nptr[i]) - == '\0' - ) - break; - - break; - } - else if ( wnptr[i] == '\0' ) - break; - - if ( sdp->exp_val >= 0 ) /* else some sign extension */ - { - errno = 0; /* shouldn't be changed */ - - if ( (uintmax = wcstoumax(wnptr, (wchar_t **)NULL, - sdp->base - ) - ) != sdp->exp_val - ) { - int save = errno; - - WARN(); - printf("*** wcstoumax(%s,NULL,%d) failed; " - "should be: %"PRIuMAX", was: %"PRIuMAX - " ***\n", sdp->nptr, sdp->base, - sdp->exp_val, uintmax - ); - status = EXIT_FAILURE; - errno = save; - } - - if ( errno != 0 ) - { - WARN(); - printf("*** wcstoumax modified errno ***\n"); - status = EXIT_FAILURE; - } - - for ( i = 0; i < 64; ++i ) - if ( wnptr[i] != sdp->nptr[i] ) - { - WARN(); - printf("*** wcstoumax" - " modified its input ***\n" - ); - status = EXIT_FAILURE; - - for ( ; i < 64; ++i ) - if ( (wnptr[i] = sdp->nptr[i]) - == '\0' - ) - break; - - break; - } - else if ( wnptr[i] == '\0' ) - break; - } - } - - /* - 7.8.2.3 The strtoimax and strtoumax functions (continued) - */ - - if ( (intmax = strtoimax("1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != INTMAX_MAX || errno != ERANGE - ) { - printf("*** strtoimax failed overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (intmax = strtoimax("+1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != INTMAX_MAX || errno != ERANGE - ) { - printf("*** strtoimax failed +overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (intmax = strtoimax("-1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != INTMAX_MIN || errno != ERANGE - ) { - printf("*** strtoimax failed -overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = strtoumax("1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** strtoumax failed overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = strtoumax("+1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** strtoumax failed +overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = strtoumax("-1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890", - &endptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** strtoumax failed -overflow test ***\n"); - status = EXIT_FAILURE; - } - - /* - 7.8.2.4 The wcstoimax and wcstoumax functions (continued) - */ - -#ifdef NO_INTERNAL_WCHAR - printf("NO_INTERNAL_WCHAR\n"); -#else - - if ( (intmax = wcstoimax(L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != INTMAX_MAX || errno != ERANGE - ) { - printf("*** wcstoimax failed overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (intmax = wcstoimax(L"+1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != INTMAX_MAX || errno != ERANGE - ) { - printf("*** wcstoimax failed +overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (intmax = wcstoimax(L"-1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != INTMAX_MIN || errno != ERANGE - ) { - printf("*** wcstoimax failed -overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = wcstoumax(L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** wcstoumax failed overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = wcstoumax(L"+1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** wcstoumax failed +overflow test ***\n"); - status = EXIT_FAILURE; - } - - if ( (uintmax = wcstoumax(L"-1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890" - L"1234567890123456789012345678901234567890", - &wendptr, 0 - ) - ) != UINTMAX_MAX || errno != ERANGE - ) { - printf("*** wcstoumax failed -overflow test ***\n"); - status = EXIT_FAILURE; - } -#endif // NO_INTERNAL_WCHAR - } -#endif /* defined(INTMAX_MAX) */ - - if ( status != 0 ) - printf("sitest failed.\n"); - - return status; -} - -#endif \ No newline at end of file From d712abfe27ed61e8f68281f1e60e33690aeab5d2 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 16:45:23 +0100 Subject: [PATCH 03/22] include s26 to get bitsize of char --- test/val/cq4.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 3 deletions(-) diff --git a/test/val/cq4.c b/test/val/cq4.c index 94f4d5fb7..8a8125c52 100644 --- a/test/val/cq4.c +++ b/test/val/cq4.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ @@ -41,7 +43,124 @@ struct defs { int crc; /* Cumulative return code */ char rfs[8]; /* Return from section */ -/*#include "cq26.c"*/ /* hardware check */ +#define CQ26_INCLUDED +/* + section s26, which pokes around at the hardware + trying to figure out the characteristics of the machine that + it is running on, saves information that is subsequently + used by sections s626, s72, and s757. If this program is + to be broken up into smallish pieces, say for running on + a microcomputer, take care to see that s26 is called before + calling any of the latter three sections. +*/ + +/* + 2.6 Hardware Characteristics +*/ + +#ifndef NO_OLD_FUNC_DECL +s26(pd0) +struct defs *pd0; +{ +#else +s26(struct defs *pd0) { +#endif + static char qs26[8] = "s26 "; + char *ps, *pt; + char c0, c1; + #ifndef NO_FLOATS + float temp, one, delta; + double tempd, oned; + #endif + static char s[] = "%3d bits in %ss.\n"; + static char s2[] = "%e is the least number that can be added to 1. (%s).\n"; + + ps = qs26; + pt = pd0->rfs; + + while(*pt++ = *ps++); + + /* Here, we shake the machinery a little to see what falls + out. First, we find out how many bits are in a char. */ + + pd0->cbits = 0; + c0 = 0; + c1 = 1; + + while(c0 != c1) { + c1 = c1<<1; + pd0->cbits = pd0->cbits+1; + } + /* That information lets us determine the size of everything else. */ + + pd0->ibits = pd0->cbits * sizeof(int); + pd0->sbits = pd0->cbits * sizeof(short); + pd0->lbits = pd0->cbits * sizeof(long); + pd0->ubits = pd0->cbits * sizeof(unsigned); + #ifndef NO_FLOATS + pd0->fbits = pd0->cbits * sizeof(float); + pd0->dbits = pd0->cbits * sizeof(double); + #endif + + /* We have now almost reconstructed the table in section 2.6, the + exception being the range of the floating point hardware. + Now there are just so many ways to conjure up a floating point + representation system that it's damned near impossible to guess + what's going on by writing a program to interpret bit patterns. + Further, the information isn't all that useful, if we consider + the fact that machines that won't handle numbers between 10**30 + and 10**-30 are very hard to find, and that people playing with + numbers outside that range have a lot more to worry about than + just the capacity of the characteristic. + + A much more useful measure is the precision, which can be ex- + pressed in terms of the smallest number that can be added to + 1. without loss of significance. We calculate that here, for + float and double. */ + +#ifndef NO_FLOATS + one = 1.; + delta = 1.; + temp = 0.; + while(temp != one) { + temp = one+delta; + delta = delta/2.; + } + pd0->fprec = delta * 4.; + oned = 1.; + delta = 1.; + tempd = 0.; + while(tempd != oned) { + tempd = oned+delta; + delta = delta/2.; + } + pd0->dprec = delta * 4.; +#endif + + /* Now, if anyone's interested, we publish the results. */ + +#ifndef CQ26_INCLUDED + if(pd0->flgm != 0) { + printf(s,pd0->cbits,"char"); + printf(s,pd0->ibits,"int"); + printf(s,pd0->sbits,"short"); + printf(s,pd0->lbits,"long"); + printf(s,pd0->ubits,"unsigned"); + printf(s,pd0->fbits,"float"); + printf(s,pd0->dbits,"double"); + #ifndef NO_FLOATS + printf(s2,pd0->fprec,"float"); + printf(s2,pd0->dprec,"double"); + #else + printf("NO_FLOATS\n"); + #endif + } +#endif + /* Since we are only exploring and perhaps reporting, but not + testing any features, we cannot return an error code. */ + + return 0; +} int extvar; @@ -125,10 +244,13 @@ implementation */ target = ~0U; mask = 1; + printf("sizeof target: %08x pd0->cbits: %08x\n", sizeof target, pd0->cbits); + printf("mask: %08x target: %08x\n", mask, target); for(j=0; j<(sizeof target)*pd0->cbits; j++){ mask = mask⌖ target = target>>1; + printf("mask: %08x target: %08x\n", mask, target); } if(mask != 1 || target != 0){ @@ -200,11 +322,12 @@ setev(){ int section(int j,void* pd0){ #endif switch(j){ - case 0: return s4(pd0); + case 0: return s26(pd0); + case 1: return s4(pd0); } } -#define cq_sections 1 +#define cq_sections 2 /* C REFERENCE MANUAL (main) From a20cb090320282c857f71825a79f38e573ded5c3 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 16:59:31 +0100 Subject: [PATCH 04/22] added makefile and common include --- test/val/add3.c | 2 ++ test/val/cc65091020.c | 2 ++ test/val/compare5.c | 5 ++--- test/val/cq22.c | 2 ++ test/val/cq241.c | 2 ++ test/val/cq243.c | 2 ++ test/val/cq244.c | 2 ++ test/val/cq25.c | 2 ++ test/val/cq26.c | 2 ++ test/val/cq61.c | 2 ++ test/val/cq626.c | 2 ++ test/val/cq71.c | 2 ++ test/val/cq714.c | 2 ++ test/val/cq714b.c | 2 ++ test/val/cq715.c | 2 ++ test/val/cq72.c | 2 ++ test/val/cq757.c | 2 ++ test/val/cq7813.c | 2 ++ test/val/cq81.c | 2 ++ test/val/cq84.c | 2 ++ test/val/cq85.c | 2 ++ test/val/cq86.c | 2 ++ test/val/cq88.c | 2 ++ test/val/cq9.c | 2 ++ 24 files changed, 48 insertions(+), 3 deletions(-) diff --git a/test/val/add3.c b/test/val/add3.c index abbc93b47..c031f1d0f 100644 --- a/test/val/add3.c +++ b/test/val/add3.c @@ -4,6 +4,8 @@ !!LICENCE!! GPL, read COPYING.GPL */ +#include "common.h" + #include #include #include diff --git a/test/val/cc65091020.c b/test/val/cc65091020.c index 8ec11ef8d..8f62f970e 100644 --- a/test/val/cc65091020.c +++ b/test/val/cc65091020.c @@ -5,6 +5,8 @@ !!AUTHOR!! Johan Kotlinski */ +#include "common.h" + #include struct { diff --git a/test/val/compare5.c b/test/val/compare5.c index b5dd93f01..b0a9f1649 100644 --- a/test/val/compare5.c +++ b/test/val/compare5.c @@ -4,6 +4,8 @@ !!LICENCE!! GPL, read COPYING.GPL */ +#include "common.h" + #include #include @@ -291,19 +293,16 @@ void c_minus1(void) printf("(long0 != -1)\n"); if(long0 != -1) { - LOG_ERROR(1); failures++; } printf("(long0 > 0)\n"); if(long0 > 0) { - LOG_ERROR(1); failures++; } printf("(long1 < 0)\n"); if(long1 < 0) { - LOG_ERROR(1); failures++; } /* diff --git a/test/val/cq22.c b/test/val/cq22.c index 4ce40ecc0..bcd1570c8 100644 --- a/test/val/cq22.c +++ b/test/val/cq22.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq241.c b/test/val/cq241.c index d7d8ed952..76f437e0c 100644 --- a/test/val/cq241.c +++ b/test/val/cq241.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq243.c b/test/val/cq243.c index 03b08b4d2..676c73182 100644 --- a/test/val/cq243.c +++ b/test/val/cq243.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq244.c b/test/val/cq244.c index 52695bfb6..bedf51e95 100644 --- a/test/val/cq244.c +++ b/test/val/cq244.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq25.c b/test/val/cq25.c index d4a0c4a90..9cb2f61c8 100644 --- a/test/val/cq25.c +++ b/test/val/cq25.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq26.c b/test/val/cq26.c index 42527e80f..399f0a45e 100644 --- a/test/val/cq26.c +++ b/test/val/cq26.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + #ifndef CQ26_INCLUDED struct defs { int cbits; /* No. of bits per char */ diff --git a/test/val/cq61.c b/test/val/cq61.c index f40b21d61..3dcca6454 100644 --- a/test/val/cq61.c +++ b/test/val/cq61.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq626.c b/test/val/cq626.c index 7fab43f53..166d3a95b 100644 --- a/test/val/cq626.c +++ b/test/val/cq626.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq71.c b/test/val/cq71.c index 342b9809a..7bf0d9e1e 100644 --- a/test/val/cq71.c +++ b/test/val/cq71.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + /*include "cq26.c"*/ /* hardware check */ struct defs { diff --git a/test/val/cq714.c b/test/val/cq714.c index 1d36b18ab..f4c58801f 100644 --- a/test/val/cq714.c +++ b/test/val/cq714.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq714b.c b/test/val/cq714b.c index 9a09a88f0..b4908f4cb 100644 --- a/test/val/cq714b.c +++ b/test/val/cq714b.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq715.c b/test/val/cq715.c index dd829156c..fec9c6170 100644 --- a/test/val/cq715.c +++ b/test/val/cq715.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq72.c b/test/val/cq72.c index 5f60fdcad..2f956e59d 100644 --- a/test/val/cq72.c +++ b/test/val/cq72.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq757.c b/test/val/cq757.c index 7c898ca5b..60b588555 100644 --- a/test/val/cq757.c +++ b/test/val/cq757.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq7813.c b/test/val/cq7813.c index 77d34a2a6..0e743abcd 100644 --- a/test/val/cq7813.c +++ b/test/val/cq7813.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq81.c b/test/val/cq81.c index 198cbc4f6..0271cae5d 100644 --- a/test/val/cq81.c +++ b/test/val/cq81.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq84.c b/test/val/cq84.c index fcadd9af6..d37c82f29 100644 --- a/test/val/cq84.c +++ b/test/val/cq84.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq85.c b/test/val/cq85.c index 3e5ef938d..15b055b20 100644 --- a/test/val/cq85.c +++ b/test/val/cq85.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq86.c b/test/val/cq86.c index 2800307f7..9f2409e7a 100644 --- a/test/val/cq86.c +++ b/test/val/cq86.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq88.c b/test/val/cq88.c index 77bb9e88c..a15f75110 100644 --- a/test/val/cq88.c +++ b/test/val/cq88.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ diff --git a/test/val/cq9.c b/test/val/cq9.c index 698443ce6..228ac9e77 100644 --- a/test/val/cq9.c +++ b/test/val/cq9.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + struct defs { int cbits; /* No. of bits per char */ int ibits; /* int */ From 20072a379c009f24c5d6c7792265bcb26d4f7dfb Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 17:02:46 +0100 Subject: [PATCH 05/22] added makefile and common include --- test/.gitignore | 2 ++ test/val/Makefile | 56 +++++++++++++++++++++++++++++++++++++++++++++++ test/val/common.h | 22 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 test/.gitignore create mode 100644 test/val/Makefile create mode 100644 test/val/common.h diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 000000000..5baabe900 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,2 @@ +*.o +*.prg diff --git a/test/val/Makefile b/test/val/Makefile new file mode 100644 index 000000000..5f93e1c34 --- /dev/null +++ b/test/val/Makefile @@ -0,0 +1,56 @@ + +CC65FLAGS = -t sim6502 + +CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) +SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) + +RM := rm -f + +.PHONY: all + +TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) + +all: $(TESTS) + +%.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.o.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.os.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.osi.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.osir.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.oi.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.oir.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +%.or.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $@ + +clean: + @$(RM) *.o + @$(RM) *.prg diff --git a/test/val/common.h b/test/val/common.h new file mode 100644 index 000000000..dada61a14 --- /dev/null +++ b/test/val/common.h @@ -0,0 +1,22 @@ + +#include +#include + +#define NO_OLD_FUNC_DECL +#define NO_TYPELESS_INT +#define NO_TYPELESS_INT_PTR +#define MAIN_RETURNS_INT +#define NO_IMPLICIT_FUNC_PROTOTYPES +#define NO_FLOATS +#define NO_WCHAR +#define NO_EMPTY_FUNC_ARGS +#define NO_SLOPPY_STRUCT_INIT +#define NO_FUNCS_TAKE_STRUCTS +#define NO_FUNCS_RETURN_STRUCTS +#define CAST_STRUCT_PTR +#define NO_TYPELESS_STRUCT_PTR +#define NO_IMPLICIT_FUNCPTR_CONV +#define SIZEOF_INT_16BIT +#define SIZEOF_LONG_32BIT +#define UNSIGNED_CHARS +#define UNSIGNED_BITFIELDS From 6144063a6da78d74b3b251fbbe8a9e073de01935 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 18:28:05 +0100 Subject: [PATCH 06/22] fixed up the rest of the tests, added rudimentary makefile(s) --- test/.gitignore | 1 + test/Makefile | 16 +++++++++++ test/err/Makefile | 42 +++++++++++++++++++++++++++++ test/ref/8q.c | 2 ++ test/ref/Makefile | 62 +++++++++++++++++++++++++++++++++++++++++++ test/ref/cc65080227.c | 2 ++ test/ref/cc65080328.c | 2 ++ test/ref/cc65090111.c | 2 ++ test/ref/cc65090124.c | 2 ++ test/ref/cc65090726.c | 2 ++ test/ref/cc65090910.c | 2 ++ test/ref/cc65090913.c | 2 ++ test/ref/cc65091007.c | 2 ++ test/ref/cc65091022.c | 2 ++ test/ref/cc65110211.c | 2 ++ test/ref/cf.c | 12 ++++++++- test/ref/cf.in | 19 +++++++++++++ test/ref/charconst.c | 1 + test/ref/common.h | 22 +++++++++++++++ test/ref/cvt.c | 3 +++ test/ref/fields.c | 2 ++ test/ref/init.c | 9 ++++--- test/ref/minimal.c | 2 ++ test/ref/otccex.c | 2 ++ test/ref/paranoia.c | 3 +++ test/ref/pointer2.c | 5 ++-- test/ref/spill.c | 1 + test/ref/stdarg.c | 1 + test/ref/struct.c | 2 ++ test/ref/switch.c | 1 + test/ref/wf1.c | 9 +++++++ test/ref/wf1.in | 17 ++++++++++++ test/ref/yacc.c | 12 ++++++++- test/ref/yacc.in | 1 + test/ref/yacc2.c | 2 ++ test/val/Makefile | 19 +++++++------ 36 files changed, 272 insertions(+), 16 deletions(-) create mode 100644 test/Makefile create mode 100644 test/err/Makefile create mode 100644 test/ref/Makefile create mode 100755 test/ref/cf.in create mode 100644 test/ref/common.h create mode 100644 test/ref/wf1.in create mode 100755 test/ref/yacc.in diff --git a/test/.gitignore b/test/.gitignore index 5baabe900..ccdd4aef5 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,2 +1,3 @@ *.o *.prg +*.out diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 000000000..4c03f2cd5 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,16 @@ + +# toplevel makefile for the regression tests + +MAKE := make --no-print-dir + +.PHONY: all clean + +all: + @$(MAKE) -C val all + @$(MAKE) -C ref all + @$(MAKE) -C err all + +clean: + @$(MAKE) -C val clean + @$(MAKE) -C ref clean + @$(MAKE) -C err clean diff --git a/test/err/Makefile b/test/err/Makefile new file mode 100644 index 000000000..6f919b3d1 --- /dev/null +++ b/test/err/Makefile @@ -0,0 +1,42 @@ + +# makefile for the tests that MUST NOT compile + +CC65FLAGS = -t sim6502 + +CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) +SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) + +RM := rm -f + +.PHONY: all + +TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) + +all: $(TESTS) + +%.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.o.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.os.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.osi.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.osir.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.oi.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.oir.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +%.or.prg: %.c + ! $(CL65) $(CC65FLAGS) $< -o $@ +clean: + @$(RM) *.o + @$(RM) *.prg diff --git a/test/ref/8q.c b/test/ref/8q.c index afbe41c64..e8bd1ca2e 100644 --- a/test/ref/8q.c +++ b/test/ref/8q.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include + int up[15], down[15], rows[8], x[8]; void queens(int c); void print(void); diff --git a/test/ref/Makefile b/test/ref/Makefile new file mode 100644 index 000000000..85cbb9bd8 --- /dev/null +++ b/test/ref/Makefile @@ -0,0 +1,62 @@ + +# makefile for the regression tests that generate output which has to be +# compared with reference output + +CC65FLAGS = -t sim6502 +SIM65FLAGS = -x 200000000 + +CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) +SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) + +RM := rm -f + +.PHONY: all + +TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) + +all: $(TESTS) + +%.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.o.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.os.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.osi.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.osir.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.oi.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.oir.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +%.or.prg: %.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > $*.out + +clean: + @$(RM) *.o + @$(RM) *.prg + @$(RM) *.out + @$(RM) *.ref diff --git a/test/ref/cc65080227.c b/test/ref/cc65080227.c index 4dd454b98..78afbb2c2 100644 --- a/test/ref/cc65080227.c +++ b/test/ref/cc65080227.c @@ -5,6 +5,8 @@ !!AUTHOR!! */ +#include + long a; /* must be static life */ long b; /* must be static life */ diff --git a/test/ref/cc65080328.c b/test/ref/cc65080328.c index 11ef73514..630638f3d 100644 --- a/test/ref/cc65080328.c +++ b/test/ref/cc65080328.c @@ -13,6 +13,8 @@ optimizations. If I remove the struct inside f() it compiles fine ?!? Best, Oliver */ +#include + void f(void){struct{int i;}d;} struct{void(*p)(void);}s={f}; diff --git a/test/ref/cc65090111.c b/test/ref/cc65090111.c index f515716f7..be889a608 100644 --- a/test/ref/cc65090111.c +++ b/test/ref/cc65090111.c @@ -5,6 +5,8 @@ !!AUTHOR!! */ +#include + /* cc65 doesn't compile this, if i use the "-O"-option. but it works with "while(!0)"; instead of "for(;;);" diff --git a/test/ref/cc65090124.c b/test/ref/cc65090124.c index fef22268f..3f8279b27 100644 --- a/test/ref/cc65090124.c +++ b/test/ref/cc65090124.c @@ -5,6 +5,8 @@ !!AUTHOR!! */ +#include + /* there is a bug in the preprocessor (i think) ... the following works (compiles) correctly: diff --git a/test/ref/cc65090726.c b/test/ref/cc65090726.c index fb4773afb..b260f0afd 100644 --- a/test/ref/cc65090726.c +++ b/test/ref/cc65090726.c @@ -5,6 +5,8 @@ !!AUTHOR!! */ +#include "common.h" + struct Record { struct Record *PtrComp; int x; diff --git a/test/ref/cc65090910.c b/test/ref/cc65090910.c index c8e5ce934..6ac5d9dcb 100644 --- a/test/ref/cc65090910.c +++ b/test/ref/cc65090910.c @@ -5,6 +5,8 @@ !!AUTHOR!! Oliver Schmidt */ +#include + /* After spending a "little" time I finally succeeded in isolating an (maybe THE) optimizer bug causing Contiki to fail. diff --git a/test/ref/cc65090913.c b/test/ref/cc65090913.c index a319fec50..da6e37ef3 100644 --- a/test/ref/cc65090913.c +++ b/test/ref/cc65090913.c @@ -18,6 +18,8 @@ */ +#include + int foo=0,bar=2; int main(void) diff --git a/test/ref/cc65091007.c b/test/ref/cc65091007.c index 1c69e02f9..31f725f8b 100644 --- a/test/ref/cc65091007.c +++ b/test/ref/cc65091007.c @@ -5,6 +5,8 @@ !!AUTHOR!! Johan Kotlinski */ +#include + /* This produces the compiler error "test.c(9): Error: Assignment to const" Shouldn't be an error, should it? baz is const, bar isn't. diff --git a/test/ref/cc65091022.c b/test/ref/cc65091022.c index 222253992..25d197c11 100644 --- a/test/ref/cc65091022.c +++ b/test/ref/cc65091022.c @@ -5,6 +5,8 @@ !!AUTHOR!! Johan Kotlinski */ +#include + /* ...gives "test.c(2): Error: Variable `foo' has unknown size" using -Cl. Is it really unknown? diff --git a/test/ref/cc65110211.c b/test/ref/cc65110211.c index 76b3f4a70..83be84b67 100644 --- a/test/ref/cc65110211.c +++ b/test/ref/cc65110211.c @@ -8,6 +8,8 @@ test2 and test3 will result in an endless loop (SVN version: 4974M) */ +#include + #define OPENTEST() #define CLOSETEST() diff --git a/test/ref/cf.c b/test/ref/cf.c index 951f31295..66fb42b10 100644 --- a/test/ref/cf.c +++ b/test/ref/cf.c @@ -8,11 +8,16 @@ cf - print character frequencies */ +#include "common.h" + #include #include #include +FILE *in; + #define INFILE "cf.in" +#define GETCHAR() fgetc(in) #ifndef NO_FLOATS float f[0x100]; @@ -35,6 +40,11 @@ char *argv[]; signed cutoff; #endif + in = fopen(INFILE, "rb"); + if (in == NULL) { + return EXIT_FAILURE; + } + if (argc <= 1) #ifndef NO_FLOATS cutoff = 0.0; @@ -176,6 +186,6 @@ char *argv[]; #endif } } - + fclose(in); return 0; } diff --git a/test/ref/cf.in b/test/ref/cf.in new file mode 100755 index 000000000..1b0a6f23a --- /dev/null +++ b/test/ref/cf.in @@ -0,0 +1,19 @@ +start cf.input > +The sky above the port was the color of television, tuned +to a dead channel. +"It's not like I'm using," Case heard someone say, as he +shouldered his way through the crowd around the door of the +Chat. "It's like my body's developed this massive drug deficiency." +It was a Sprawl voice and a Sprawl joke. The Chatsubo +was a bar for professional expatriates; you could drink there +for a week and never hear two words in Japanese. +Ratz was tending bar, his prosthetic arm jerking monotonously +as he filled a tray of glasses with draft Kirin. He saw +Case and smiled, his teeth a web work of East European steel +and brown decay. Case found a place at the bar, between the +unlikely tan on one of Lonny Zone's whores and the crisp naval +uniform of a tall African whose cheekbones were ridged with +Joe boys," Ratz said, shoving a draft across the bar with his +good hand. "Maybe some business with you, Case?" +Case shrugged. The girl to his right giggled and nudged +< end cf.input \ No newline at end of file diff --git a/test/ref/charconst.c b/test/ref/charconst.c index 1aa9f8e3f..65ebc70be 100644 --- a/test/ref/charconst.c +++ b/test/ref/charconst.c @@ -4,6 +4,7 @@ !!LICENCE!! Public Domain */ +#include "common.h" #include #include diff --git a/test/ref/common.h b/test/ref/common.h new file mode 100644 index 000000000..dada61a14 --- /dev/null +++ b/test/ref/common.h @@ -0,0 +1,22 @@ + +#include +#include + +#define NO_OLD_FUNC_DECL +#define NO_TYPELESS_INT +#define NO_TYPELESS_INT_PTR +#define MAIN_RETURNS_INT +#define NO_IMPLICIT_FUNC_PROTOTYPES +#define NO_FLOATS +#define NO_WCHAR +#define NO_EMPTY_FUNC_ARGS +#define NO_SLOPPY_STRUCT_INIT +#define NO_FUNCS_TAKE_STRUCTS +#define NO_FUNCS_RETURN_STRUCTS +#define CAST_STRUCT_PTR +#define NO_TYPELESS_STRUCT_PTR +#define NO_IMPLICIT_FUNCPTR_CONV +#define SIZEOF_INT_16BIT +#define SIZEOF_LONG_32BIT +#define UNSIGNED_CHARS +#define UNSIGNED_BITFIELDS diff --git a/test/ref/cvt.c b/test/ref/cvt.c index ed7b6084e..841c1b3b2 100644 --- a/test/ref/cvt.c +++ b/test/ref/cvt.c @@ -4,6 +4,9 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" +#include + signed char c; signed short s; signed int i; diff --git a/test/ref/fields.c b/test/ref/fields.c index 794a81924..83bee82b7 100644 --- a/test/ref/fields.c +++ b/test/ref/fields.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + #ifdef NO_BITFIELDS main() diff --git a/test/ref/init.c b/test/ref/init.c index dc3f28a81..5a5816753 100644 --- a/test/ref/init.c +++ b/test/ref/init.c @@ -4,12 +4,13 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" /* todo: add back conditional stuff here ! */ typedef struct { int codes[3]; char name[6]; } Word; -#ifdef NO_IMPLICIT_FUNC_PROTOTYPES - +#ifdef NO_IMPLICIT_FUNC_PROTOTYPES + #ifdef NO_OLD_FUNC_DECL f(); void g(Word *p); @@ -42,8 +43,8 @@ Word words[] = { /*int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } };*/ int x[][5] = { {1, 2, 3, 4, 0 }, { 5, 6 }, { 7 } }; -int *y[] = { x[0], x[1], x[2], 0 }; - +int *y[] = { x[0], x[1], x[2], 0 }; + main() { int i, j; diff --git a/test/ref/minimal.c b/test/ref/minimal.c index 5aa3c5f4f..b2e2d9d8f 100644 --- a/test/ref/minimal.c +++ b/test/ref/minimal.c @@ -5,6 +5,8 @@ !!AUTHOR!! Groepaz/Hitmen */ +#include + int main(void) { #if 1 diff --git a/test/ref/otccex.c b/test/ref/otccex.c index a967e4805..f3d6c71ec 100644 --- a/test/ref/otccex.c +++ b/test/ref/otccex.c @@ -4,6 +4,8 @@ !!LICENCE!! GPL (?), read COPYING.GPL */ +#include "common.h" + /* * Sample OTCC C example. You can uncomment the first line and install * otcc in /usr/local/bin to make otcc scripts ! diff --git a/test/ref/paranoia.c b/test/ref/paranoia.c index 3616c9391..e9a47dd71 100644 --- a/test/ref/paranoia.c +++ b/test/ref/paranoia.c @@ -4,11 +4,14 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + #ifdef NO_FLOATS main() { printf("NO_FLOATS\n\r"); + return 0; } #else diff --git a/test/ref/pointer2.c b/test/ref/pointer2.c index 69d04a989..d8c064ef3 100644 --- a/test/ref/pointer2.c +++ b/test/ref/pointer2.c @@ -4,6 +4,7 @@ !!LICENCE!! public domain */ +#include "common.h" #include /* @@ -101,11 +102,11 @@ static void test30(void) cc65 seems to have problems here aswell ;/ */ -int main(void) { +int main(void) { test1(); test2(); test30(); test31(); /* test32(); */ - return 0; + return 0; } diff --git a/test/ref/spill.c b/test/ref/spill.c index 2aedf0c8c..56b03d6a7 100644 --- a/test/ref/spill.c +++ b/test/ref/spill.c @@ -4,6 +4,7 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" #include int main(void) diff --git a/test/ref/stdarg.c b/test/ref/stdarg.c index b476cf338..295a2ccad 100644 --- a/test/ref/stdarg.c +++ b/test/ref/stdarg.c @@ -4,6 +4,7 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" #include #ifndef NO_FUNCS_TAKE_STRUCTS diff --git a/test/ref/struct.c b/test/ref/struct.c index ccd74953f..a0f181e96 100644 --- a/test/ref/struct.c +++ b/test/ref/struct.c @@ -4,6 +4,8 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" + typedef struct point { int x,y; } point; typedef struct rect { point pt1, pt2; } rect; diff --git a/test/ref/switch.c b/test/ref/switch.c index 1fc315d90..0821d29ee 100644 --- a/test/ref/switch.c +++ b/test/ref/switch.c @@ -4,6 +4,7 @@ !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC */ +#include "common.h" #include #ifdef NO_IMPLICIT_FUNC_PROTOTYPES diff --git a/test/ref/wf1.c b/test/ref/wf1.c index 3e9c80fb2..0539d8398 100644 --- a/test/ref/wf1.c +++ b/test/ref/wf1.c @@ -11,6 +11,9 @@ #define MAXWORDS 250 +FILE *in; +#define getchar() fgetc(in) + struct node { int count; /* frequency count */ @@ -122,11 +125,17 @@ int main(void) struct node *root; char word[20]; + in = fopen("wf1.in","rb"); + if (in == NULL) { + return EXIT_FAILURE; + } + root = 0; next = 0; while (getword(word)) lookup(word, &root)->count++; tprint(root); + fclose(in); return 0; } diff --git a/test/ref/wf1.in b/test/ref/wf1.in new file mode 100644 index 000000000..3e50fbac8 --- /dev/null +++ b/test/ref/wf1.in @@ -0,0 +1,17 @@ +The sky above the port was the color of television, tuned +to a dead channel. +"It's not like I'm using," Case heard someone say, as he +shouldered his way through the crowd around the door of the +Chat. "It's like my body's developed this massive drug deficiency." +It was a Sprawl voice and a Sprawl joke. The Chatsubo +was a bar for professional expatriates; you could drink there +for a week and never hear two words in Japanese. +Ratz was tending bar, his prosthetic arm jerking monotonously +as he filled a tray of glasses with draft Kirin. He saw +Case and smiled, his teeth a web work of East European steel +and brown decay. Case found a place at the bar, between the +unlikely tan on one of Lonny Zone's whores and the crisp naval +uniform of a tall African whose cheekbones were ridged with +Joe boys," Ratz said, shoving a draft across the bar with his +good hand. "Maybe some business with you, Case?" +Case shrugged. The girl to his right giggled and nudged diff --git a/test/ref/yacc.c b/test/ref/yacc.c index 3baefd348..5768f80d0 100644 --- a/test/ref/yacc.c +++ b/test/ref/yacc.c @@ -6,6 +6,8 @@ /*#define STANDALONE*/ +#include "common.h" + #ifndef YACCDBG #include @@ -19,6 +21,9 @@ #endif +FILE *infile, *outfile; +#define getchar() fgetc(infile) + /* hack the original tables to work with both petscii and ascii */ #define CHARSETHACK @@ -61,7 +66,6 @@ int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; -/*FILE *yyin ={stdin}, *yyout ={stdout};*/ #define yyin infile #define yyout outfile @@ -665,7 +669,13 @@ yyunput(c) main() { printf("main start\n"); + infile = fopen("yacc.in","rb"); + if (infile == NULL) { + return EXIT_FAILURE; + } + outfile = stdout; yyparse(); + fclose(infile); printf("main end\n"); return 0; } diff --git a/test/ref/yacc.in b/test/ref/yacc.in new file mode 100755 index 000000000..0b89df5d7 --- /dev/null +++ b/test/ref/yacc.in @@ -0,0 +1 @@ +x=(e+1)*3/(3+7) diff --git a/test/ref/yacc2.c b/test/ref/yacc2.c index c62fca34a..78d654ded 100644 --- a/test/ref/yacc2.c +++ b/test/ref/yacc2.c @@ -5,6 +5,8 @@ !!AUTHOR!! Groepaz/Hitmen */ +#include + # define YYTYPE char struct yywork { diff --git a/test/val/Makefile b/test/val/Makefile index 5f93e1c34..0e4a6e94c 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -1,5 +1,8 @@ +# makefile for the regression tests that return an error code on failure + CC65FLAGS = -t sim6502 +SIM65FLAGS = -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) @@ -21,35 +24,35 @@ all: $(TESTS) %.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.o.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.os.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.osi.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.osir.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.oi.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.oir.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ %.or.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $@ + $(SIM65) $(SIM65FLAGS) $@ clean: @$(RM) *.o From 20cf4e1cc7a65b1b0d57f6fb493157b016916c03 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 19:42:39 +0100 Subject: [PATCH 07/22] moved tests that need special care into misc dir --- test/{ref => misc}/fields.c | 0 test/{ref => misc}/limits.c | 0 test/misc/sitest.c | 1591 +++++++++++++++++++++++++++++++++++ 3 files changed, 1591 insertions(+) rename test/{ref => misc}/fields.c (100%) rename test/{ref => misc}/limits.c (100%) create mode 100644 test/misc/sitest.c diff --git a/test/ref/fields.c b/test/misc/fields.c similarity index 100% rename from test/ref/fields.c rename to test/misc/fields.c diff --git a/test/ref/limits.c b/test/misc/limits.c similarity index 100% rename from test/ref/limits.c rename to test/misc/limits.c diff --git a/test/misc/sitest.c b/test/misc/sitest.c new file mode 100644 index 000000000..9570f4989 --- /dev/null +++ b/test/misc/sitest.c @@ -0,0 +1,1591 @@ +/* + !!DESCRIPTION!! C99 WCHAR test + !!ORIGIN!! + !!LICENCE!! public domain +*/ + +/* + sitest -- exercise features of C99 and + + This source code has been placed into the PUBLIC DOMAIN by its author. + + last edit: 1999/11/05 gwyn@arl.mil + + Tries to accommodate pre-C99 versions of . + + Takes advantage of __Q8_* symbols defined by a particular + implementation of , but doesn't require them. + + NOTE: This is not a thorough validation test of the facilities. +*/ + +#define NO_INTERNAL_WCHAR +/*#define STANDALONE*/ + +#include +#include /* for CHAR_BIT */ +#include +#include /* for ptrdiff_t */ +#include +#include + +#if !defined(STANDARD_C99) && !defined(STANDARD_CC65) + +#error "this test checks C99 features, which are not available in the selected standard." + +#else + +#ifdef NO_WCHAR + +#warn "this test checks C99 features, but NO_WCHAR is defined so the test will most definetly fails." + +#endif + +#include /* embeds */ + +#include /* for sig_atomic_t */ + +#if defined(INTMAX_MAX) /* has C99 features */ +#include +#endif + +#include /* test idempotency */ + +#ifdef STANDALONE + +FILE *outfile=NULL; +#define opentest(x) outfile=stdout; +#define closetest(x) + +#else + +#endif + +#if __STDC_VERSION__ >= 199901 +#ifndef __Q8_QT +#define __Q8_QT long long +#endif +#endif + +#ifdef PRIdMAX +#define HAVE_PRIdMAX +#ifndef __Q8_MT +#define __Q8_MT intmax_t +#endif +#else +#ifdef PRIdLEAST64 +#ifndef __Q8_MT +#define __Q8_MT int_least64_t +#endif +#define PRIdMAX PRIdLEAST64 +#else +#ifndef __Q8_MT +#define __Q8_MT long +#endif +#define PRIdMAX "ld" +#endif +#endif + +#ifdef PRIuMAX +#define HAVE_PRIuMAX +#define U__Q8_MT uintmax_t +#else +#ifdef PRIuLEAST64 +#define U__Q8_MT uint_least64_t +#define PRIuMAX PRIuLEAST64 +#else +#define U__Q8_MT unsigned long +#define PRIuMAX "lu" +#endif +#endif + +#define STR_SUB(s) # s +#define STRINGIZE(s) STR_SUB(s) /* extra level to expand argument */ + +#if defined(SCNo32) || defined(PRIo32) +static int32_t int32; +#endif +static int_least16_t intl16; +static uint_least16_t uintl16; +static uint_fast16_t uintf16; +static intmax_t intmax; +static uintmax_t uintmax; + +int +main() { + int status = 0; /* exit status to be returned */ + + + /* features: */ + + printf("CHAR_BIT=%u\n", (unsigned)CHAR_BIT ); + printf("sizeof(char)=%u\n", (unsigned)sizeof(char)); /* s.b. 1 */ + printf("sizeof(short)=%u\n", (unsigned)sizeof(short)); + printf("sizeof(int)=%u\n", (unsigned)sizeof(int)); + printf("sizeof(long)=%u\n", (unsigned)sizeof(long)); +#ifdef __Q8_QT + printf("sizeof(long long)=%u\n", (unsigned)sizeof(__Q8_QT)); +#else + printf("*** long long isn't defined ***\n"); +#endif + printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t)); + printf("sizeof(ptrdiff_t)=%u\n", (unsigned)sizeof(ptrdiff_t)); + printf("sizeof(size_t)=%u\n", (unsigned)sizeof(size_t)); + printf("sizeof(sig_atomic_t)=%u\n", (unsigned)sizeof(sig_atomic_t)); + printf("sizeof(wchar_t)=%u\n", (unsigned)sizeof(wchar_t)); +#if defined(WINT_MAX) || __STDC_VERSION__ >= 199901 + printf("sizeof(wint_t)=%u\n", (unsigned)sizeof(wint_t)); +#else + printf("*** wint_t isn't defined ***\n"); + status = EXIT_FAILURE; +#endif +#ifdef INT8_MAX + printf("sizeof(int8_t)=%u\n", (unsigned)sizeof(int8_t)); + printf("sizeof(uint8_t)=%u\n", (unsigned)sizeof(uint8_t)); +#endif +#ifdef INT9_MAX + printf("sizeof(int9_t)=%u\n", (unsigned)sizeof(int9_t)); + printf("sizeof(uint9_t)=%u\n", (unsigned)sizeof(uint9_t)); +#endif +#ifdef INT12_MAX + printf("sizeof(int12_t)=%u\n", (unsigned)sizeof(int12_t)); + printf("sizeof(uint12_t)=%u\n", (unsigned)sizeof(uint12_t)); +#endif +#ifdef INT16_MAX + printf("sizeof(int16_t)=%u\n", (unsigned)sizeof(int16_t)); + printf("sizeof(uint16_t)=%u\n", (unsigned)sizeof(uint16_t)); +#endif +#ifdef INT18_MAX + printf("sizeof(int18_t)=%u\n", (unsigned)sizeof(int18_t)); + printf("sizeof(uint18_t)=%u\n", (unsigned)sizeof(uint18_t)); +#endif +#ifdef INT24_MAX + printf("sizeof(int24_t)=%u\n", (unsigned)sizeof(int24_t)); + printf("sizeof(uint24_t)=%u\n", (unsigned)sizeof(uint24_t)); +#endif +#ifdef INT32_MAX + printf("sizeof(int32_t)=%u\n", (unsigned)sizeof(int32_t)); + printf("sizeof(uint32_t)=%u\n", (unsigned)sizeof(uint32_t)); +#endif +#ifdef INT36_MAX + printf("sizeof(int36_t)=%u\n", (unsigned)sizeof(int36_t)); + printf("sizeof(uint36_t)=%u\n", (unsigned)sizeof(uint36_t)); +#endif +#ifdef INT40_MAX + printf("sizeof(int40_t)=%u\n", (unsigned)sizeof(int40_t)); + printf("sizeof(uint40_t)=%u\n", (unsigned)sizeof(uint40_t)); +#endif +#ifdef INT48_MAX + printf("sizeof(int48_t)=%u\n", (unsigned)sizeof(int48_t)); + printf("sizeof(uint48_t)=%u\n", (unsigned)sizeof(uint48_t)); +#endif +#ifdef INT60_MAX + printf("sizeof(int60_t)=%u\n", (unsigned)sizeof(int60_t)); + printf("sizeof(uint60_t)=%u\n", (unsigned)sizeof(uint60_t)); +#endif +#ifdef INT64_MAX + printf("sizeof(int64_t)=%u\n", (unsigned)sizeof(int64_t)); + printf("sizeof(uint64_t)=%u\n", (unsigned)sizeof(uint64_t)); +#endif +#ifdef INT72_MAX + printf("sizeof(int72_t)=%u\n", (unsigned)sizeof(int72_t)); + printf("sizeof(uint72_t)=%u\n", (unsigned)sizeof(uint72_t)); +#endif +#ifdef INT128_MAX + printf("sizeof(int128_t)=%u\n", (unsigned)sizeof(int128_t)); + printf("sizeof(uint128_t)=%u\n", (unsigned)sizeof(uint128_t)); +#endif + printf("sizeof(int_least8_t)=%u\n", (unsigned)sizeof(int_least8_t)); + printf("sizeof(uint_least8_t)=%u\n", (unsigned)sizeof(uint_least8_t)); + printf("sizeof(int_least16_t)=%u\n", (unsigned)sizeof(int_least16_t)); + printf("sizeof(uint_least16_t)=%u\n", (unsigned)sizeof(uint_least16_t)); + printf("sizeof(int_least32_t)=%u\n", (unsigned)sizeof(int_least32_t)); + printf("sizeof(uint_least32_t)=%u\n", (unsigned)sizeof(uint_least32_t)); +#ifdef INT_LEAST64_MAX + printf("sizeof(int_least64_t)=%u\n", (unsigned)sizeof(int_least64_t)); + printf("sizeof(uint_least64_t)=%u\n", (unsigned)sizeof(uint_least64_t)); +#else + printf("*** uint_least64_t isn't defined ***\n"); + status = EXIT_FAILURE; +#endif +#ifdef INT_LEAST128_MAX + printf("sizeof(int_least128_t)=%u\n", (unsigned)sizeof(int_least128_t)); + printf("sizeof(uint_least128_t)=%u\n", + (unsigned)sizeof(uint_least128_t)); +#endif + printf("sizeof(int_fast8_t)=%u\n", (unsigned)sizeof(int_fast8_t)); + printf("sizeof(uint_fast8_t)=%u\n", (unsigned)sizeof(uint_fast8_t)); + printf("sizeof(int_fast16_t)=%u\n", (unsigned)sizeof(int_fast16_t)); + printf("sizeof(uint_fast16_t)=%u\n", (unsigned)sizeof(uint_fast16_t)); + printf("sizeof(int_fast32_t)=%u\n", (unsigned)sizeof(int_fast32_t)); + printf("sizeof(uint_fast32_t)=%u\n", (unsigned)sizeof(uint_fast32_t)); +#ifdef INT_FAST64_MAX + printf("sizeof(int_fast64_t)=%u\n", (unsigned)sizeof(int_fast64_t)); + printf("sizeof(uint_fast64_t)=%u\n", (unsigned)sizeof(uint_fast64_t)); +#else + printf("*** int_fast64_t isn't defined ***\n"); + status = EXIT_FAILURE; +#endif +#ifdef INT_FAST128_MAX + printf("sizeof(int_fast128_t)=%u\n", (unsigned)sizeof(int_fast128_t)); + printf("sizeof(uint_fast128_t)=%u\n", (unsigned)sizeof(uint_fast128_t)); +#endif +#if defined(INTPTR_MAX) + printf("sizeof(intptr_t)=%u\n", (unsigned)sizeof(intptr_t)); +#if defined(UINTPTR_MAX) + printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t)); +#else + printf("*** intptr_t is defined but uintptr_t isn't ***\n"); + status = EXIT_FAILURE; +#endif +#elif defined(UINTPTR_MAX) + printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t)); + printf("*** uintptr_t is defined but intptr_t isn't ***\n"); + status = EXIT_FAILURE; +#else + printf("*** neither intptr_t nor uintptr_t is defined ***\n"); + status = EXIT_FAILURE; +#endif +#ifdef INTMAX_MAX + printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t)); + printf("sizeof(uintmax_t)=%u\n", (unsigned)sizeof(uintmax_t)); +#else + printf("*** intmax_t isn't defined ***\n"); + status = EXIT_FAILURE; +#endif + +#ifdef INT8_MAX + printf("INT8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT8_MIN); + printf("INT8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT8_MAX); + printf("UINT8_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT8_MAX); +#endif +#ifdef INT9_MAX + printf("INT9_MIN=%"PRIdMAX"\n", (__Q8_MT)INT9_MIN); + printf("INT9_MAX=%"PRIdMAX"\n", (__Q8_MT)INT9_MAX); + printf("UINT9_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT9_MAX); +#endif +#ifdef INT12_MAX + printf("INT12_MIN=%"PRIdMAX"\n", (__Q8_MT)INT12_MIN); + printf("INT12_MAX=%"PRIdMAX"\n", (__Q8_MT)INT12_MAX); + printf("UINT12_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT12_MAX); +#endif +#ifdef INT16_MAX + printf("INT16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT16_MIN); + printf("INT16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT16_MAX); + printf("UINT16_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT16_MAX); +#endif +#ifdef INT18_MAX + printf("INT18_MIN=%"PRIdMAX"\n", (__Q8_MT)INT18_MIN); + printf("INT18_MAX=%"PRIdMAX"\n", (__Q8_MT)INT18_MAX); + printf("UINT18_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT18_MAX); +#endif +#ifdef INT24_MAX + printf("INT24_MIN=%"PRIdMAX"\n", (__Q8_MT)INT24_MIN); + printf("INT24_MAX=%"PRIdMAX"\n", (__Q8_MT)INT24_MAX); + printf("UINT24_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT24_MAX); +#endif +#ifdef INT32_MAX + printf("INT32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT32_MIN); + printf("INT32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT32_MAX); + printf("UINT32_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT32_MAX); +#endif +#ifdef INT36_MAX + printf("INT36_MIN=%"PRIdMAX"\n", (__Q8_MT)INT36_MIN); + printf("INT36_MAX=%"PRIdMAX"\n", (__Q8_MT)INT36_MAX); + printf("UINT36_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT36_MAX); +#endif +#ifdef INT40_MAX + printf("INT40_MIN=%"PRIdMAX"\n", (__Q8_MT)INT40_MIN); + printf("INT40_MAX=%"PRIdMAX"\n", (__Q8_MT)INT40_MAX); + printf("UINT40_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT40_MAX); +#endif +#ifdef INT48_MAX + printf("INT48_MIN=%"PRIdMAX"\n", (__Q8_MT)INT48_MIN); + printf("INT48_MAX=%"PRIdMAX"\n", (__Q8_MT)INT48_MAX); + printf("UINT48_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT48_MAX); +#endif +#ifdef INT60_MAX + printf("INT60_MIN=%"PRIdMAX"\n", (__Q8_MT)INT60_MIN); + printf("INT60_MAX=%"PRIdMAX"\n", (__Q8_MT)INT60_MAX); + printf("UINT60_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT60_MAX); +#endif +#ifdef INT64_MAX + printf("INT64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT64_MIN); + printf("INT64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT64_MAX); + printf("UINT64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT64_MAX); +#endif +#ifdef INT72_MAX + printf("INT72_MIN=%"PRIdMAX"\n", (__Q8_MT)INT72_MIN); + printf("INT72_MAX=%"PRIdMAX"\n", (__Q8_MT)INT72_MAX); + printf("UINT72_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT72_MAX); +#endif +#ifdef INT128_MAX + printf("INT128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT128_MIN); + printf("INT128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT128_MAX); + printf("UINT128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT128_MAX); +#endif + printf("INT_LEAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MIN); + printf("INT_LEAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MAX); + printf("UINT_LEAST8_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_LEAST8_MAX); + printf("INT_LEAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MIN); + printf("INT_LEAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MAX); + printf("UINT_LEAST16_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_LEAST16_MAX); + printf("INT_LEAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MIN); + printf("INT_LEAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MAX); + printf("UINT_LEAST32_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_LEAST32_MAX); +#ifdef INT_LEAST64_MAX + printf("INT_LEAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MIN); + printf("INT_LEAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MAX); + printf("UINT_LEAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST64_MAX); +#endif +#ifdef INT_LEAST128_MAX + printf("INT_LEAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MIN); + printf("INT_LEAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MAX); + printf("UINT_LEAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST128_MAX); +#endif + printf("INT_FAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MIN); + printf("INT_FAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MAX); + printf("UINT_FAST8_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_FAST8_MAX); + printf("INT_FAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MIN); + printf("INT_FAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MAX); + printf("UINT_FAST16_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_FAST16_MAX); + printf("INT_FAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MIN); + printf("INT_FAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MAX); + printf("UINT_FAST32_MAX=%"PRIuMAX"\n", + (U__Q8_MT)UINT_FAST32_MAX); +#ifdef INT_FAST64_MAX + printf("INT_FAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MIN); + printf("INT_FAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MAX); + printf("UINT_FAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST64_MAX); +#endif +#ifdef INT_FAST128_MAX + printf("INT_FAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MIN); + printf("INT_FAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MAX); + printf("UINT_FAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST128_MAX); +#endif +#ifdef INTPTR_MAX + printf("INTPTR_MIN=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MIN); + printf("INTPTR_MAX=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MAX); +#endif +#ifdef UINTPTR_MAX + printf("UINTPTR_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTPTR_MAX); +#endif +#ifdef INTMAX_MAX + printf("INTMAX_MIN=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MIN); + printf("INTMAX_MAX=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MAX); + printf("UINTMAX_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTMAX_MAX); +#endif +#ifdef PTRDIFF_MAX + printf("PTRDIFF_MIN=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MIN); + printf("PTRDIFF_MAX=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MAX); +#endif +#ifdef SIG_ATOMIC_MAX +#if SIG_ATOMIC_MIN < 0 + printf("SIG_ATOMIC_MIN=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MIN); + printf("SIG_ATOMIC_MAX=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MAX); +#else + printf("SIG_ATOMIC_MIN=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MIN); + printf("SIG_ATOMIC_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MAX); +#endif +#endif +#ifdef SIZE_MAX + printf("SIZE_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIZE_MAX); +#endif + +#ifdef WCHAR_MAX +#if WCHAR_MIN < 0 + printf("WCHAR_MIN=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MIN); + printf("WCHAR_MAX=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MAX); +#else + printf("WCHAR_MIN=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MIN); + printf("WCHAR_MAX=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MAX); +#endif +#endif +#ifdef WINT_MAX +#if WINT_MIN < 0 + printf("WINT_MIN=%"PRIdMAX"\n", (__Q8_MT)WINT_MIN); + printf("WINT_MAX=%"PRIdMAX"\n", (__Q8_MT)WINT_MAX); +#else + printf("WINT_MIN=%"PRIuMAX"\n", (U__Q8_MT)WINT_MIN); + printf("WINT_MAX=%"PRIuMAX"\n", (U__Q8_MT)WINT_MAX); +#endif +#endif + + /* + 7.18.4 Macros for integer constants + */ + + /* INTn_C for n=8 and 16 were at one point unimplementable + on most platforms, so they're treated as "optional": */ +#ifdef INT8_C + if ( INT8_C(-123) != -123 ) + printf("*** INT8_C(-123) produced %"PRIdMAX" ***\n", + (__Q8_MT)INT8_C(-123) + ); + if ( UINT8_C(123) != 123 ) + printf("*** UINT8_C(123) produced %"PRIuMAX" ***\n", + (U__Q8_MT)UINT8_C(123) + ); +#endif +#ifdef INT16_C + if ( INT16_C(-12345) != -12345 ) + printf("*** INT16_C(-12345) produced %"PRIdMAX" ***\n", + (__Q8_MT)INT16_C(-12345) + ); + if ( UINT16_C(12345) != 12345 ) + printf("*** UINT16_C(12345) produced %"PRIuMAX" ***\n", + (U__Q8_MT)UINT16_C(12345) + ); +#endif + if ( INT32_C(-123456789) != -123456789 ) + printf("*** INT32_C(-123456789) produced %"PRIdMAX" ***\n", + (__Q8_MT)INT32_C(-123456789) + ); + if ( UINT32_C(123456789) != 123456789 ) + printf("*** UINT32_C(123456789) produced %"PRIuMAX" ***\n", + (U__Q8_MT)UINT32_C(123456789) + ); +#ifdef INT_LEAST64_MAX + if ( INT64_C(-1234567890123456789) != -1234567890123456789 ) + printf("*** INT64_C(-1234567890123456789) produced %"PRIdMAX + " ***\n", + (__Q8_MT)INT64_C(-1234567890123456789) + ); + if ( UINT64_C(1234567890123456789) != 1234567890123456789 ) + printf("*** UINT64_C(1234567890123456789) produced %"PRIuMAX + " ***\n", + (U__Q8_MT)UINT64_C(1234567890123456789) + ); +#endif +#ifdef INTMAX_MAX + if ( INTMAX_C(-1234567890123456789) != -1234567890123456789 ) + printf("*** INTMAX_C(-1234567890123456789) produced %"PRIdMAX + " ***\n", + (__Q8_MT)INTMAX_C(-1234567890123456789) + ); + if ( UINTMAX_C(1234567890123456789) != 1234567890123456789 ) + printf("*** UINTMAX_C(1234567890123456789) produced %"PRIuMAX + " ***\n", + (U__Q8_MT)UINTMAX_C(1234567890123456789) + ); +#endif + + /* features: */ + +#if __STDC_VERSION__ >= 199901 + printf("sizeof(imaxdiv_t)=%u\n", (unsigned)sizeof(imaxdiv_t)); +#endif + + /* + 7.8.1 Macros for format specifiers + */ + + { + /* scanf these strings */ + static const char in_dn[] = "Z119bZ"; + static const char in_dmo[] = "Z-0119bZ"; + static const char in_dspx[] = "Z \t\n +0X119bZ"; + static const char in_dsmx[] = "Z \t\n -0x119bZ"; + static const char in_dsn[] = "Z \t\n 119bZ"; + static const char in_dp[] = "Z+119bZ"; + static const char in_dpx[] = "Z+0X119bz"; + + /* sprintf into this */ + static char buffer[1024]; + +#if 1 + +#define SCAN(buf,fs,var,exp) if ( sscanf(buf, "Z%" fs, &var) != 1 ) \ + { \ + printf("***%s=",fs, STR_SUB(fs) \ + " failed ***\n" \ + ); \ + status = EXIT_FAILURE; \ + } \ + else if ( var != (exp) ) \ + { \ + printf("***%s=",fs, STR_SUB(fs) \ + " should be: " STR_SUB(exp) \ + ", was: %" fs " ***\n", var \ + ); \ + status = EXIT_FAILURE; \ + } \ + else /* for trailing semicolon */ + +#define PRINT(fs,var,exp) if ( sprintf(buffer, "%" fs, var ) <= 0 ) \ + { \ + printf("***%s=",fs, STR_SUB(fs) \ + " failed ***\n" \ + ); \ + status = EXIT_FAILURE; \ + } \ + else if ( strcmp(buffer, STR_SUB(exp)) != 0 ) \ + { \ + printf("***%s=",fs, STR_SUB(fs) \ + " should be: " STR_SUB(exp) \ + ", was: %s ***\n", buffer \ + ); \ + status = EXIT_FAILURE; \ + } \ + else /* for trailing semicolon */ + +#else + +#define SCAN(buf,fs,var,exp) +#define PRINT(fs,var,exp) + +#endif + +#ifdef SCNo32 + + SCAN(in_dn, SCNo32, int32, 9); + +#endif +#ifdef PRIo32 + PRINT(PRIo32, int32, 11); +#endif + SCAN(in_dmo, SCNiLEAST16, intl16, -9); + SCAN(in_dspx, SCNdLEAST16, intl16, 0); + SCAN(in_dsmx, SCNiLEAST16, intl16, -4507); + PRINT(PRIdLEAST16, intl16, -4507); + PRINT(PRIiLEAST16, intl16, -4507); + SCAN(in_dsn, SCNxLEAST16, uintl16, 4507); + PRINT(PRIoLEAST16, uintl16, 10633); + PRINT(PRIuLEAST16, uintl16, 4507); + PRINT(PRIxLEAST16, uintl16, 119b); + PRINT(PRIXLEAST16, uintl16, 119B); + SCAN(in_dp, SCNxFAST16, uintf16, 4507); + PRINT(PRIxFAST16, uintf16, 119b); +#ifdef SCNdMAX + SCAN(in_dp, SCNdMAX, intmax, 119); +#endif +#ifdef PRIiMAX + PRINT(PRIiMAX, intmax, 119); +#endif +#ifdef SCNoMAX + SCAN(in_dpx, SCNoMAX, uintmax, 0); +#endif +#ifdef PRIxMAX + PRINT(PRIxMAX, uintmax, 0); +#endif + /* Obviously there should be a much larger battery of such tests. */ + } + +#if defined(INTMAX_MAX) /* has C99 features */ + /* + 7.8.2 Functions for greatest-width integer types + */ + + { + static struct + { + intmax_t input; + intmax_t expect; + } abs_data[] = + { +#ifdef INT8_MAX + { INT8_MAX, INT8_MAX, }, + { -INT8_MAX, INT8_MAX, }, + { UINT8_MAX, UINT8_MAX, }, +#endif + +#if 0 + +#ifdef INT16_MAX + { INT16_MAX, INT16_MAX, }, + { -INT16_MAX, INT16_MAX, }, + { UINT16_MAX, UINT16_MAX, }, +#endif +#ifdef INT32_MAX + { INT32_MAX, INT32_MAX, }, + { -INT32_MAX, INT32_MAX, }, +#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ + { UINT32_MAX, UINT32_MAX, }, +#endif +#endif +#ifdef INT64_MAX + { INT64_MAX, INT64_MAX, }, + { -INT64_MAX, INT64_MAX, }, +#endif + { INT_LEAST8_MAX, INT_LEAST8_MAX, }, + { -INT_LEAST8_MAX, INT_LEAST8_MAX, }, + { UINT_LEAST8_MAX, UINT_LEAST8_MAX, }, + { INT_LEAST16_MAX, INT_LEAST16_MAX, }, + { -INT_LEAST16_MAX, INT_LEAST16_MAX, }, + { UINT_LEAST16_MAX, UINT_LEAST16_MAX, }, + { INT_LEAST32_MAX, INT_LEAST32_MAX, }, + { -INT_LEAST32_MAX, INT_LEAST32_MAX, }, +#ifdef INT_LEAST64_MAX + { UINT_LEAST32_MAX, UINT_LEAST32_MAX, }, + { INT_LEAST64_MAX, INT_LEAST64_MAX, }, + { -INT_LEAST64_MAX, INT_LEAST64_MAX, }, +#endif + { INT_FAST8_MAX, INT_FAST8_MAX, }, + { -INT_FAST8_MAX, INT_FAST8_MAX, }, + { UINT_FAST8_MAX, UINT_FAST8_MAX, }, + { INT_FAST16_MAX, INT_FAST16_MAX, }, + { -INT_FAST16_MAX, INT_FAST16_MAX, }, + { UINT_FAST16_MAX, UINT_FAST16_MAX, }, + { INT_FAST32_MAX, INT_FAST32_MAX, }, + { -INT_FAST32_MAX, INT_FAST32_MAX, }, +#ifdef INT_FAST64_MAX + { UINT_FAST32_MAX, UINT_FAST32_MAX, }, + { INT_FAST64_MAX, INT_FAST64_MAX, }, + { -INT_FAST64_MAX, INT_FAST64_MAX, }, +#endif +#ifdef INTPTR_MAX + { INTPTR_MAX, INTPTR_MAX, }, + { -INTPTR_MAX, INTPTR_MAX, }, +#endif +#ifdef UINTPTR_MAX + { UINTPTR_MAX, UINTPTR_MAX, }, +#endif + { INTMAX_MAX, INTMAX_MAX, }, +#ifdef PTRDIFF_MAX + { PTRDIFF_MAX, PTRDIFF_MAX, }, +#endif +#ifdef SIG_ATOMIC_MAX + { SIG_ATOMIC_MAX, SIG_ATOMIC_MAX, }, +#if SIG_ATOMIC_MIN < 0 + { -SIG_ATOMIC_MAX, SIG_ATOMIC_MAX, }, +#endif +#endif +#ifdef SIZE_MAX + { SIZE_MAX, SIZE_MAX, }, +#endif +#ifdef WCHAR_MAX + { WCHAR_MAX, WCHAR_MAX, }, +#if WCHAR_MIN < 0 + { -WCHAR_MAX, WCHAR_MAX, }, +#endif +#endif +#ifdef WINT_MAX + { WINT_MAX, WINT_MAX, }, +#if WINT_MIN < 0 + { -WINT_MAX, WINT_MAX, }, +#endif +#endif + { 127, 127, }, + { -127, 127, }, + { 128, 128, }, + { -127-1, 128, }, + { 255, 255, }, + { -256+1, 255, }, + { 256, 256, }, + { -256, 256, }, + { 32767, 32767, }, + { -32767, 32767, }, + { 32768, 32768, }, + { -32767-1, 32768, }, + { 65535, 65535, }, + { -65536+1, 65535, }, + { 65536, 65536, }, + { -65536, 65536, }, + { 2147483647, 2147483647, }, + { -2147483647, 2147483647, }, + { 2147483648, 2147483648, }, + { -2147483647-1, 2147483648, }, +#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ + { 4294967295, 4294967295, }, + { -4294967296+1, 4294967295, }, + { 4294967296, 4294967296, }, + { -4294967296, 4294967296, }, + { 9223372036854775807, 9223372036854775807, }, + { -9223372036854775807, 9223372036854775807, }, + { 1234567890123456789, 1234567890123456789, }, + { -1234567890123456789, 1234567890123456789, }, +#endif + { 1, 1, }, + { -1, 1, }, + { 2, 2, }, + { -2, 2, }, + { 10, 10, }, + { -10, 10, }, + { 16, 16, }, + { -16, 16, }, +#endif + /* Other test cases can be added here. */ + { 0, 0 /* terminates the list */ }, + }, *adp = abs_data; + + do { + if ( (intmax = imaxabs(adp->input)) != adp->expect ) + { + printf("*** imaxabs(%"PRIdMAX") failed; should be: %" + PRIdMAX", was: %"PRIdMAX" ***\n", + adp->input, adp->expect, intmax + ); + status = EXIT_FAILURE; + } +// } while ( adp++->input != 0 ); + } while ( (adp++)->input != 0 ); + } + + { + imaxdiv_t result; + static struct + { + intmax_t numer; + intmax_t denom; + intmax_t exp_quot; + intmax_t exp_rem; + } div_data[] = + { + { 0, 1, 0, 0, }, +#if 0 + { 0, -1, 0, 0, }, + { 0, 2, 0, 0, }, + { 0, -2, 0, 0, }, + { 0, 5, 0, 0, }, + { 0, -5, 0, 0, }, + { 1, 1, 1, 0, }, + { 1, -1, -1, 0, }, + { 1, 2, 0, 1, }, + { 1, -2, 0, 1, }, + { 1, 5, 0, 1, }, + { 1, -5, 0, 1, }, + { -1, 1, -1, 0, }, + { -1, -1, 1, 0, }, + { -1, 2, 0, -1, }, + { -1, -2, 0, -1, }, + { -1, 5, 0, -1, }, + { -1, -5, 0, -1, }, + { 2, 1, 2, 0, }, + { 2, -1, -2, 0, }, + { 2, 2, 1, 0, }, + { 2, -2, -1, 0, }, + { 2, 5, 0, 2, }, + { 2, -5, 0, 2, }, + { -2, 1, -2, 0, }, + { -2, -1, 2, 0, }, + { -2, 2, -1, 0, }, + { -2, -2, 1, 0, }, + { -2, 5, 0, -2, }, + { -2, -5, 0, -2, }, + { 17, 5, 3, 2, }, + { -17, -5, 3, -2, }, + { 17, -5, -3, 2, }, + { -17, 5, -3, -2, }, + { 2147483647, 1, 2147483647, 0, }, + { -2147483647, 1, -2147483647, 0, }, + { 2147483648, 1, 2147483648, 0, }, + { -2147483647-1, 1, -2147483647-1, 0, }, + { 2147483647, 2, 1073741823, 1, }, + { -2147483647, 2, -1073741823, -1, }, + { 2147483648, 2, 1073741824, 0, }, + { -2147483647-1, 2, -1073741824, 0, }, +#ifdef INT_LEAST64_MAX /* else might support only 32 bits */ + { 4294967295, 1, 4294967295, 0, }, + { -4294967296+1, 1, -4294967296+1, 0, }, + { 4294967296, 1, 4294967296, 0, }, + { -4294967296, 1, -4294967296, 0, }, + { 4294967295, -1, -4294967296+1, 0, }, + { -4294967296+1, -1, 4294967295, 0, }, + { 4294967296, -1, -4294967296, 0, }, + { -4294967296, -1, 4294967296, 0, }, + { 4294967295, 2, 2147483647, 1, }, + { -4294967296+1, 2, -2147483647, -1, }, + { 4294967296, 2, 2147483648, 0, }, + { -4294967296, 2, -2147483647-1, 0, }, + { 4294967295, 2147483647, 2, 1, }, + { -4294967296+1, 2147483647, -2, -1, }, + { 4294967296, 2147483647, 2, 2, }, + { -4294967296, 2147483647, -2, -2, }, + { 4294967295, -2147483647, -2, 1, }, + { -4294967296+1, -2147483647, 2, -1, }, + { 4294967296, -2147483647, -2, 2, }, + { -4294967296, -2147483647, 2, -2, }, + { 4294967295, 2147483648, 1, 2147483647, }, + { -4294967296+1, 2147483648, -1, -2147483647, }, + { 4294967296, 2147483648, 2, 0, }, + { -4294967296, 2147483648, -2, 0, }, + { 4294967295, -2147483647-1, -1, 2147483647, }, + { -4294967296+1, -2147483647-1, 1, -2147483647,}, + { 4294967296, -2147483647-1, -2, 0, }, + { -4294967296, -2147483647-1, 2, 0, }, + { 9223372036854775807, 1, 9223372036854775807, 0, }, + { -9223372036854775807, 1, -9223372036854775807, 0, }, + { 9223372036854775807, 2, 4611686018427387903, 1, }, + { -9223372036854775807, 2, -4611686018427387903, -1, }, +#endif +#endif + /* There should be a much larger battery of such tests. */ + { 0, 0, 0, 0 }, /* 0 denom terminates the list */ + }, *ddp; + +#if 0 + for ( ddp = div_data; ddp->denom != 0; ++ddp ) + if ( (result = imaxdiv(ddp->numer, ddp->denom)).quot + != ddp->exp_quot || result.rem != ddp->exp_rem + ) { +// printf("*** imaxdiv(%"PRIdMAX",%"PRIdMAX +// ") failed; should be: (%"PRIdMAX",%"PRIdMAX +// "), was: (%"PRIdMAX",%"PRIdMAX") ***\n", +// ddp->numer, ddp->denom, ddp->exp_quot, +// ddp->exp_rem, result.quot, result.rem +// ); + printf("err:imaxdiv(%"PRIdMAX",%"PRIdMAX + ") = (%"PRIdMAX",%"PRIdMAX + "), is: (%"PRIdMAX",%"PRIdMAX")\n", + ddp->numer, ddp->denom, ddp->exp_quot, + ddp->exp_rem, result.quot, result.rem + ); + status = EXIT_FAILURE; + } +#endif + } + + { + char *endptr; + wchar_t *wendptr; + static char saved[64]; /* holds copy of input string */ + static wchar_t wnptr[64]; /* holds wide copy of test string */ + static int warned; /* "warned for null endptr" flag */ + register int i; + static struct + { + char * nptr; + int base; + intmax_t exp_val; + int exp_len; + } str_data[] = + { + { "", 0, 0, 0, }, + { "", 2, 0, 0, }, + { "", 8, 0, 0, }, + { "", 9, 0, 0, }, + { "", 10, 0, 0, }, + { "", 16, 0, 0, }, + { "", 36, 0, 0, }, + { "0", 0, 0, 1, }, + { "0", 2, 0, 1, }, + { "0", 8, 0, 1, }, + { "0", 9, 0, 1, }, + { "0", 10, 0, 1, }, + { "0", 16, 0, 1, }, + { "0", 36, 0, 1, }, + { "+0", 0, 0, 2, }, + { "+0", 2, 0, 2, }, + { "+0", 8, 0, 2, }, + { "+0", 9, 0, 2, }, + { "+0", 10, 0, 2, }, + { "+0", 16, 0, 2, }, + { "+0", 36, 0, 2, }, + { "-0", 0, 0, 2, }, + { "-0", 2, 0, 2, }, + { "-0", 8, 0, 2, }, + { "-0", 9, 0, 2, }, + { "-0", 10, 0, 2, }, + { "-0", 16, 0, 2, }, + { "-0", 36, 0, 2, }, + { "Inf", 0, 0, 0, }, + { "Inf", 2, 0, 0, }, + { "Inf", 8, 0, 0, }, + { "Inf", 9, 0, 0, }, + { "Inf", 10, 0, 0, }, + { "Inf", 16, 0, 0, }, + { "Inf", 36, 24171, 3, }, + { "+Inf", 0, 0, 0, }, + { "+Inf", 2, 0, 0, }, + { "+Inf", 8, 0, 0, }, + { "+Inf", 9, 0, 0, }, + { "+Inf", 10, 0, 0, }, + { "+Inf", 16, 0, 0, }, + { "+Inf", 36, 24171, 4, }, + { "-Inf", 0, 0, 0, }, + { "-Inf", 2, 0, 0, }, + { "-Inf", 8, 0, 0, }, + { "-Inf", 9, 0, 0, }, + { "-Inf", 10, 0, 0, }, + { "-Inf", 16, 0, 0, }, + { "-Inf", 36, -24171, 4, }, + { "inf", 0, 0, 0, }, + { "inf", 2, 0, 0, }, + { "inf", 8, 0, 0, }, + { "inf", 9, 0, 0, }, + { "inf", 10, 0, 0, }, + { "inf", 16, 0, 0, }, + { "inf", 36, 24171, 3, }, + { "+inf", 0, 0, 0, }, + { "+inf", 2, 0, 0, }, + { "+inf", 8, 0, 0, }, + { "+inf", 9, 0, 0, }, + { "+inf", 10, 0, 0, }, + { "+inf", 16, 0, 0, }, + { "+inf", 36, 24171, 4, }, + { "-inf", 0, 0, 0, }, + { "-inf", 2, 0, 0, }, + { "-inf", 8, 0, 0, }, + { "-inf", 9, 0, 0, }, + { "-inf", 10, 0, 0, }, + { "-inf", 16, 0, 0, }, + { "-inf", 36, -24171, 4, }, + { "119b8Z", 0, 119, 3, }, + { "119bZ", 0, 119, 3, }, + { "-0119bZ", 0, -9, 4, }, + { " \t\n 0X119bZ", 0, 4507, 10, }, + { " \t\n +0X119bZ", 0, 4507, 11, }, + { " \t\n -0x119bZ", 0, -4507, 11, }, + { " \t\n 119bZ", 0, 119, 7, }, + { "+119bZ", 0, 119, 4, }, + { "+0X119bz", 0, 4507, 7, }, + { "119b8Z", 2, 3, 2, }, + { "119bZ", 2, 3, 2, }, + { "-0119bZ", 2, -3, 4, }, + { " \t\n 0X119bZ", 2, 0, 5, }, + { " \t\n +0X119bZ", 2, 0, 6, }, + { " \t\n -0x119bZ", 2, 0, 6, }, + { " \t\n 119bZ", 2, 3, 6, }, + { "+119bZ", 2, 3, 3, }, + { "+0X119bz", 2, 0, 2, }, + { "119b8Z", 8, 9, 2, }, + { "119bZ", 8, 9, 2, }, + { "-0119bZ", 8, -9, 4, }, + { " \t\n 0X119bZ", 8, 0, 5, }, + { " \t\n +0X119bZ", 8, 0, 6, }, + { " \t\n -0x119bZ", 8, 0, 6, }, + { " \t\n 119bZ", 8, 9, 6, }, + { "+119bZ", 8, 9, 3, }, + { "+0X119bz", 8, 0, 2, }, + { "119b8Z", 9, 10, 2, }, + { "119bZ", 9, 10, 2, }, + { "-0119bZ", 9, -10, 4, }, + { " \t\n 0X119bZ", 9, 0, 5, }, + { " \t\n +0X119bZ", 9, 0, 6, }, + { " \t\n -0x119bZ", 9, 0, 6, }, + { " \t\n 119bZ", 9, 10, 6, }, + { "+119bZ", 9, 10, 3, }, + { "+0X119bz", 9, 0, 2, }, + { "119b8Z", 10, 119, 3, }, + { "119bZ", 10, 119, 3, }, + { "-0119bZ", 10, -119, 5, }, + { " \t\n 0X119bZ", 10, 0, 5, }, + { " \t\n +0X119bZ", 10, 0, 6, }, + { " \t\n -0x119bZ", 10, 0, 6, }, + { " \t\n 119bZ", 10, 119, 7, }, + { "+119bZ", 10, 119, 4, }, + { "+0X119bz", 10, 0, 2, }, + { "119b8Z", 16, 72120, 5, }, + { "119bZ", 16, 4507, 4, }, + { "-0119bZ", 16, -4507, 6, }, + { " \t\n 0X119bZ", 16, 4507, 10, }, + { " \t\n +0X119bZ", 16, 4507, 11, }, + { " \t\n -0x119bZ", 16, -4507, 11, }, + { " \t\n 119bZ", 16, 4507,8, }, + { "+119bZ", 16, 4507, 5, }, + { "+0X119bz", 16, 4507, 7, }, + { "119b8Z", 36, 62580275, 6, }, + { "119bZ", 36, 1738367, 5, }, + { "-0119bZ", 36, -1738367, 7, }, + { " \t\n 0X119bZ", 36, 1997122175, 11, }, + { " \t\n +0X119bZ", 36, 1997122175, 12, }, + { " \t\n -0x119bZ", 36, -1997122175, 12, }, + { " \t\n 119bZ", 36, 1738367, 9, }, + { "+119bZ", 36, 1738367, 6, }, + { "+0X119bz", 36, 1997122175, 8, }, + /* There should be a much larger battery of such tests. */ + { "127", 0, 127, 3, }, + { "-127", 0, -127, 4, }, + { "128", 0, 128, 3, }, + { "-128", 0, -127-1, 4, }, + { "255", 0, 255, 3, }, + { "-255", 0, -255, 4, }, + { "256", 0, 256, 3, }, + { "-256", 0, -255-1, 4, }, + { "32767", 0, 32767, 5, }, + { "-32767", 0, -32767, 6, }, + { "32768", 0, 32768, 5, }, + { "-32768", 0, -32767-1, 6, }, + { "65535", 0, 65535, 5, }, + { "-65535", 0, -65536+1, 6, }, + { "65536", 0, 65536, 5, }, + { "-65536", 0, -65536, 6, }, + { "2147483647", 0, 2147483647, 10, }, + { "-2147483647", 0, -2147483647, 11, }, + { "2147483648", 0, 2147483648, 10, }, + { "-2147483648", 0, -2147483647-1, 11, }, + { "4294967295", 0, 4294967295, 10, }, + { "-4294967295", 0, -4294967296+1, 11, }, + { "4294967296", 0, 4294967296, 10, }, + { "-4294967296", 0, -4294967296, 11, }, + { "9223372036854775807", 0, 9223372036854775807, 19, }, + { "-9223372036854775807", 0, -9223372036854775807, 20, }, + { "1234567890123456789", 0, 1234567890123456789, 19, }, + { "-1234567890123456789", 0, -1234567890123456789, 20, }, + { "1", 0, 1, 1, }, + { "-1", 0, -1, 2, }, + { "2", 0, 2, 1, }, + { "-2", 0, -2, 2, }, + { "10", 0, 10, 2, }, + { "-10", 0, -10, 3, }, + { "16", 0, 16, 2, }, + { "-16", 0, -16, 3, }, + /* Other test cases can be added here. */ + { NULL, 0, 0, 0 }, /* terminates the list */ + }, *sdp; + + for ( sdp = str_data; sdp->nptr != NULL ; ++sdp ) + { + /* + 7.8.2.3 The strtoimax and strtoumax functions + */ + + strcpy(saved, sdp->nptr); + + errno = 0; /* shouldn't be changed */ + + if ( (intmax = strtoimax(sdp->nptr, &endptr, sdp->base)) + != sdp->exp_val + ) { + int save = errno; + + printf("*** strtoimax(%s,,%d) failed; should be: %" + PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, + sdp->base, sdp->exp_val, intmax + ); + status = EXIT_FAILURE; + errno = save; + } + else if ( endptr != sdp->nptr + sdp->exp_len ) + { + int save = errno; + + printf("*** strtoimax(%s,,%d) returned wrong endptr" + " ***\n", sdp->nptr, sdp->base + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + printf("*** strtoimax modified errno ***\n"); + status = EXIT_FAILURE; + } + + if ( strcmp(sdp->nptr, saved) != 0 ) + { + printf("*** strtoimax modified its input ***\n"); + status = EXIT_FAILURE; + strcpy(saved, sdp->nptr); + } + + if ( sdp->exp_val >= 0 ) /* else some sign extension */ + { + errno = 0; /* shouldn't be changed */ + + if ( (uintmax = strtoumax(sdp->nptr, &endptr, sdp->base + ) + ) != sdp->exp_val + ) { + int save = errno; + + printf("*** strtoumax(%s,,%d) failed; " + "should be: %"PRIuMAX", was: %"PRIuMAX + " ***\n", sdp->nptr, sdp->base, + sdp->exp_val, uintmax + ); + status = EXIT_FAILURE; + errno = save; + } + else if ( endptr != sdp->nptr + sdp->exp_len ) + { + int save = errno; + + printf("*** strtoumax(%s,,%d) returned wrong " + "endptr ***\n", sdp->nptr, sdp->base + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + printf("*** strtoumax modified errno ***\n"); + status = EXIT_FAILURE; + } + + if ( strcmp(sdp->nptr, saved) != 0 ) + { + printf("*** strtoumax" + " modified its input ***\n" + ); + status = EXIT_FAILURE; + strcpy(saved, sdp->nptr); + } + } + + /* tests for null endptr */ + +#define WARN() if (!warned) warned = 1, printf("*** Using null endptr: ***\n") + + warned = 0; + errno = 0; /* shouldn't be changed */ + + if ( (intmax = strtoimax(sdp->nptr, (char **)NULL, sdp->base)) + != sdp->exp_val + ) { + int save = errno; + + WARN(); + printf("*** strtoimax(%s,NULL,%d) failed; " + "should be: %"PRIdMAX", was: %"PRIdMAX" ***\n", + sdp->nptr, sdp->base, sdp->exp_val, intmax + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + WARN(); + printf("*** strtoimax modified errno ***\n"); + status = EXIT_FAILURE; + } + + if ( strcmp(sdp->nptr, saved) != 0 ) + { + WARN(); + printf("*** strtoimax modified its input ***\n"); + status = EXIT_FAILURE; + strcpy(saved, sdp->nptr); + } + + if ( sdp->exp_val >= 0 ) /* else some sign extension */ + { + errno = 0; /* shouldn't be changed */ + + if ( (uintmax = strtoumax(sdp->nptr, (char **)NULL, + sdp->base + ) + ) != sdp->exp_val + ) { + int save = errno; + + WARN(); + printf("*** strtoumax(%s,NULL,%d) failed; " + "should be: %"PRIuMAX", was: %"PRIuMAX + " ***\n", sdp->nptr, sdp->base, + sdp->exp_val, uintmax + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + WARN(); + printf("*** strtoumax modified errno ***\n"); + status = EXIT_FAILURE; + } + + if ( strcmp(sdp->nptr, saved) != 0 ) + { + WARN(); + printf("*** strtoumax" + " modified its input ***\n" + ); + status = EXIT_FAILURE; + strcpy(saved, sdp->nptr); + } + } + + /* + 7.8.2.4 The wcstoimax and wcstoumax functions + */ + + for ( i = 0; i < 64; ++i ) + if ( (wnptr[i] = sdp->nptr[i]) == '\0' ) + break; + + errno = 0; /* shouldn't be changed */ + + if ( (intmax = wcstoimax(wnptr, &wendptr, sdp->base)) + != sdp->exp_val + ) { + int save = errno; + + printf("*** wcstoimax(%s,,%d) failed; should be: %" + PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, + sdp->base, sdp->exp_val, intmax + ); + status = EXIT_FAILURE; + errno = save; + } + else if ( wendptr != wnptr + sdp->exp_len ) + { + int save = errno; + + printf("*** wcstoimax(%s,,%d) returned wrong endptr" + " ***\n", sdp->nptr, sdp->base + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + printf("*** wcstoimax modified errno ***\n"); + status = EXIT_FAILURE; + } + + for ( i = 0; i < 64; ++i ) + if ( wnptr[i] != sdp->nptr[i] ) + { + printf("*** wcstoimax modified its input ***\n" + ); + status = EXIT_FAILURE; + + for ( ; i < 64; ++i ) + if ( (wnptr[i] = sdp->nptr[i]) == '\0' ) + break; + + break; + } + else if ( wnptr[i] == '\0' ) + break; + + if ( sdp->exp_val >= 0 ) /* else some sign extension */ + { + errno = 0; /* shouldn't be changed */ + + if ( (uintmax = wcstoumax(wnptr, &wendptr, sdp->base) + ) != sdp->exp_val + ) { + int save = errno; + + printf("*** wcstoumax(%s,,%d) failed; " + "should be: %"PRIuMAX", was: %"PRIuMAX + " ***\n", sdp->nptr, sdp->base, + sdp->exp_val, uintmax + ); + status = EXIT_FAILURE; + errno = save; + } + else if ( wendptr != wnptr + sdp->exp_len ) + { + int save = errno; + + printf("*** wcstoumax(%s,,%d) returned wrong " + "endptr ***\n", sdp->nptr, sdp->base + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + printf("*** wcstoumax modified errno ***\n"); + status = EXIT_FAILURE; + } + + for ( i = 0; i < 64; ++i ) + if ( wnptr[i] != sdp->nptr[i] ) + { + printf("*** wcstoumax" + " modified its input ***\n" + ); + status = EXIT_FAILURE; + + for ( ; i < 64; ++i ) + if ( (wnptr[i] = sdp->nptr[i]) + == '\0' + ) + break; + + break; + } + else if ( wnptr[i] == '\0' ) + break; + } + + /* tests for null endptr */ + + warned = 0; + errno = 0; /* shouldn't be changed */ + + if ( (intmax = wcstoimax(wnptr, (wchar_t **)NULL, sdp->base)) + != sdp->exp_val + ) { + int save = errno; + + WARN(); + printf("*** wcstoimax(%s,NULL,%d) failed; should be: %" + PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr, + sdp->base, sdp->exp_val, intmax + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + WARN(); + printf("*** wcstoimax modified errno ***\n"); + status = EXIT_FAILURE; + } + + for ( i = 0; i < 64; ++i ) + if ( wnptr[i] != sdp->nptr[i] ) + { + WARN(); + printf("*** wcstoimax modified its input ***\n" + ); + status = EXIT_FAILURE; + + for ( ; i < 64; ++i ) + if ( (wnptr[i] = sdp->nptr[i]) + == '\0' + ) + break; + + break; + } + else if ( wnptr[i] == '\0' ) + break; + + if ( sdp->exp_val >= 0 ) /* else some sign extension */ + { + errno = 0; /* shouldn't be changed */ + + if ( (uintmax = wcstoumax(wnptr, (wchar_t **)NULL, + sdp->base + ) + ) != sdp->exp_val + ) { + int save = errno; + + WARN(); + printf("*** wcstoumax(%s,NULL,%d) failed; " + "should be: %"PRIuMAX", was: %"PRIuMAX + " ***\n", sdp->nptr, sdp->base, + sdp->exp_val, uintmax + ); + status = EXIT_FAILURE; + errno = save; + } + + if ( errno != 0 ) + { + WARN(); + printf("*** wcstoumax modified errno ***\n"); + status = EXIT_FAILURE; + } + + for ( i = 0; i < 64; ++i ) + if ( wnptr[i] != sdp->nptr[i] ) + { + WARN(); + printf("*** wcstoumax" + " modified its input ***\n" + ); + status = EXIT_FAILURE; + + for ( ; i < 64; ++i ) + if ( (wnptr[i] = sdp->nptr[i]) + == '\0' + ) + break; + + break; + } + else if ( wnptr[i] == '\0' ) + break; + } + } + + /* + 7.8.2.3 The strtoimax and strtoumax functions (continued) + */ + + if ( (intmax = strtoimax("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != INTMAX_MAX || errno != ERANGE + ) { + printf("*** strtoimax failed overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (intmax = strtoimax("+1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != INTMAX_MAX || errno != ERANGE + ) { + printf("*** strtoimax failed +overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (intmax = strtoimax("-1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != INTMAX_MIN || errno != ERANGE + ) { + printf("*** strtoimax failed -overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = strtoumax("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** strtoumax failed overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = strtoumax("+1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** strtoumax failed +overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = strtoumax("-1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890", + &endptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** strtoumax failed -overflow test ***\n"); + status = EXIT_FAILURE; + } + + /* + 7.8.2.4 The wcstoimax and wcstoumax functions (continued) + */ + +#ifdef NO_INTERNAL_WCHAR + printf("NO_INTERNAL_WCHAR\n"); +#else + + if ( (intmax = wcstoimax(L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != INTMAX_MAX || errno != ERANGE + ) { + printf("*** wcstoimax failed overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (intmax = wcstoimax(L"+1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != INTMAX_MAX || errno != ERANGE + ) { + printf("*** wcstoimax failed +overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (intmax = wcstoimax(L"-1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != INTMAX_MIN || errno != ERANGE + ) { + printf("*** wcstoimax failed -overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = wcstoumax(L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** wcstoumax failed overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = wcstoumax(L"+1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** wcstoumax failed +overflow test ***\n"); + status = EXIT_FAILURE; + } + + if ( (uintmax = wcstoumax(L"-1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890" + L"1234567890123456789012345678901234567890", + &wendptr, 0 + ) + ) != UINTMAX_MAX || errno != ERANGE + ) { + printf("*** wcstoumax failed -overflow test ***\n"); + status = EXIT_FAILURE; + } +#endif // NO_INTERNAL_WCHAR + } +#endif /* defined(INTMAX_MAX) */ + + if ( status != 0 ) + printf("sitest failed.\n"); + + return status; +} + +#endif \ No newline at end of file From 875e0762e788301dcca836dbf32a6dad988ba41c Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 19:45:40 +0100 Subject: [PATCH 08/22] generate reference output using host compiler, compare using diff, fix yacc input file to work on both host and sim65 --- test/.gitignore | 2 ++ test/ref/Makefile | 36 +++++++++++++++++++++++++++--------- test/ref/yacc.in | 1 + 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index ccdd4aef5..6ca887d5c 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,3 +1,5 @@ *.o *.prg *.out +*.host +*.ref diff --git a/test/ref/Makefile b/test/ref/Makefile index 85cbb9bd8..88d54a296 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -9,9 +9,14 @@ CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) RM := rm -f +DIFF := diff -q + +CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all +REFS := $(patsubst %.c,%.ref,$(wildcard *.c)) + TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) @@ -21,42 +26,55 @@ TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) -all: $(TESTS) +all: $(REFS) $(TESTS) -%.prg: %.c +%.ref: %.c + $(CC) $(CFLAGS) $< -o $*.host + ./$*.host > $@ + +%.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.o.prg: %.c +%.o.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.os.prg: %.c +%.os.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.osi.prg: %.c +%.osi.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.osir.prg: %.c +%.osir.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.oi.prg: %.c +%.oi.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.oir.prg: %.c +%.oir.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref -%.or.prg: %.c +%.or.prg: %.c %.ref $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $*.out + $(DIFF) $*.out $*.ref clean: @$(RM) *.o @$(RM) *.prg @$(RM) *.out @$(RM) *.ref + @$(RM) *.host diff --git a/test/ref/yacc.in b/test/ref/yacc.in index 0b89df5d7..79e716878 100755 --- a/test/ref/yacc.in +++ b/test/ref/yacc.in @@ -1 +1,2 @@ x=(e+1)*3/(3+7) + \ No newline at end of file From 4a9346d631de14f37561716522aaf5d08c0cbf6f Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 19:50:30 +0100 Subject: [PATCH 09/22] added todo --- test/todo | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/todo diff --git a/test/todo b/test/todo new file mode 100644 index 000000000..e69de29bb From 9fe0b3817728156f7e0d51f78e66bb67eec9932a Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 21:29:26 +0100 Subject: [PATCH 10/22] added readme --- test/readme.txt | 16 ++++++++++++++++ test/todo | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/readme.txt diff --git a/test/readme.txt b/test/readme.txt new file mode 100644 index 000000000..308b2fa90 --- /dev/null +++ b/test/readme.txt @@ -0,0 +1,16 @@ +This directory contains test code for automatic regression testing of the CC65 +compiler. + + +/val - the bulk of tests are contained here, individual tests should exit with + an exit code of EXIT_SUCCESS when they pass, or EXIT_FAILURE on error + +/ref - these tests produce output that must be compared with reference output + +/err - contains tests that MUST NOT compile + +/misc - a few tests that need special care of some sort + + +to run the tests use "make clean all" in this (top) directory, the makefile +should exit with no error. diff --git a/test/todo b/test/todo index e69de29bb..911eacdd3 100644 --- a/test/todo +++ b/test/todo @@ -0,0 +1,10 @@ + +- the tests in ./misc need special care + +- check all tests in ./ref and make them return their results as exit code + +- in ./val use some other tool than "diff" for comparing the results + +- fixup makefiles to use "del" instead of "rm -f" on windows + +- reduce usage of "common.h" to a minimum From 198bd893f9dd0e39ccff1e04b6d56ccd949bc44a Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 22 Nov 2014 22:22:30 +0100 Subject: [PATCH 11/22] makefile for misc, endless.c --- test/Makefile | 3 +++ test/misc/Makefile | 50 +++++++++++++++++++++++++++++++++++++++++++++ test/misc/common.h | 22 ++++++++++++++++++++ test/misc/endless.c | 13 ++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 test/misc/Makefile create mode 100644 test/misc/common.h create mode 100644 test/misc/endless.c diff --git a/test/Makefile b/test/Makefile index 4c03f2cd5..65df4da4c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,8 +9,11 @@ all: @$(MAKE) -C val all @$(MAKE) -C ref all @$(MAKE) -C err all + @$(MAKE) -C misc all clean: @$(MAKE) -C val clean @$(MAKE) -C ref clean @$(MAKE) -C err clean + @$(MAKE) -C misc clean + diff --git a/test/misc/Makefile b/test/misc/Makefile new file mode 100644 index 000000000..02f264cc6 --- /dev/null +++ b/test/misc/Makefile @@ -0,0 +1,50 @@ + +CC65FLAGS = -t sim6502 +SIM65FLAGS = -x 200000000 + +CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) +SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) + +RM := rm -f +DIFF := diff -q + +.PHONY: all + +TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) + +all: $(TESTS) + +# should compile, but then hangs in an endless loop +endless%prg: endless.c + $(CL65) $(CC65FLAGS) $< -o $@ + ! $(SIM65) $(SIM65FLAGS) $@ + +# these need reference data that cant be generated by a host compiled program +# in a useful way +limits%prg: limits.c + $(CL65) $(CC65FLAGS) $< -o $@ + $(SIM65) $(SIM65FLAGS) $@ > limits.out + $(DIFF) limits.out limits.ref + +# the rest are tests that fail currently for one reason or another +fields%prg: fields.c + @echo "FIXME: " $@ "will currently fail" + $(CL65) $(CC65FLAGS) $< -o $@ + -$(SIM65) $(SIM65FLAGS) $@ +sitest%prg: sitest.c + @echo "FIXME: " $@ "will currently fail" + -$(CL65) $(CC65FLAGS) $< -o $@ + -$(SIM65) $(SIM65FLAGS) $@ + +clean: + @$(RM) *.o + @$(RM) *.prg + @$(RM) *.out + diff --git a/test/misc/common.h b/test/misc/common.h new file mode 100644 index 000000000..dada61a14 --- /dev/null +++ b/test/misc/common.h @@ -0,0 +1,22 @@ + +#include +#include + +#define NO_OLD_FUNC_DECL +#define NO_TYPELESS_INT +#define NO_TYPELESS_INT_PTR +#define MAIN_RETURNS_INT +#define NO_IMPLICIT_FUNC_PROTOTYPES +#define NO_FLOATS +#define NO_WCHAR +#define NO_EMPTY_FUNC_ARGS +#define NO_SLOPPY_STRUCT_INIT +#define NO_FUNCS_TAKE_STRUCTS +#define NO_FUNCS_RETURN_STRUCTS +#define CAST_STRUCT_PTR +#define NO_TYPELESS_STRUCT_PTR +#define NO_IMPLICIT_FUNCPTR_CONV +#define SIZEOF_INT_16BIT +#define SIZEOF_LONG_32BIT +#define UNSIGNED_CHARS +#define UNSIGNED_BITFIELDS diff --git a/test/misc/endless.c b/test/misc/endless.c new file mode 100644 index 000000000..7924d7902 --- /dev/null +++ b/test/misc/endless.c @@ -0,0 +1,13 @@ + +#include +#include + +int main(void) +{ + printf("entering endless loop\n"); + for(;;) { + ; + } + printf("error: should not come here\n"); + return EXIT_FAILURE; +} \ No newline at end of file From 8a66605d5efd64828f75d5b4e3346a49d452e370 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 23 Nov 2014 12:18:19 +0100 Subject: [PATCH 12/22] added some windows/cmd.exe stuff --- test/Makefile | 8 ++++---- test/err/Makefile | 11 +++++++++-- test/misc/Makefile | 13 ++++++++++++- test/readme.txt | 4 ++-- test/ref/Makefile | 11 ++++++++++- test/todo | 6 ------ test/val/Makefile | 10 +++++++++- 7 files changed, 46 insertions(+), 17 deletions(-) diff --git a/test/Makefile b/test/Makefile index 65df4da4c..d71d5fda4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,10 +6,10 @@ MAKE := make --no-print-dir .PHONY: all clean all: - @$(MAKE) -C val all - @$(MAKE) -C ref all - @$(MAKE) -C err all - @$(MAKE) -C misc all + @$(MAKE) -C val clean all + @$(MAKE) -C ref clean all + @$(MAKE) -C err clean all + @$(MAKE) -C misc clean all clean: @$(MAKE) -C val clean diff --git a/test/err/Makefile b/test/err/Makefile index 6f919b3d1..3ced60bc8 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -1,14 +1,21 @@ # makefile for the tests that MUST NOT compile +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + CC65FLAGS = -t sim6502 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) -SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) +ifdef CMD_EXE +RM := del /f +else RM := rm -f +endif -.PHONY: all +.PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) diff --git a/test/misc/Makefile b/test/misc/Makefile index 02f264cc6..b9e4637d0 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -1,14 +1,25 @@ +# makefile for the remaining tests that need special care in one way or another + +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + CC65FLAGS = -t sim6502 SIM65FLAGS = -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) +ifdef CMD_EXE +RM := del /f +DIFF := fc +else RM := rm -f DIFF := diff -q +endif -.PHONY: all +.PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) diff --git a/test/readme.txt b/test/readme.txt index 308b2fa90..673ecabdb 100644 --- a/test/readme.txt +++ b/test/readme.txt @@ -12,5 +12,5 @@ compiler. /misc - a few tests that need special care of some sort -to run the tests use "make clean all" in this (top) directory, the makefile -should exit with no error. +to run the tests use "make" in this (top) directory, the makefile should exit +with no error. diff --git a/test/ref/Makefile b/test/ref/Makefile index 88d54a296..b3b555aef 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -2,18 +2,27 @@ # makefile for the regression tests that generate output which has to be # compared with reference output +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + CC65FLAGS = -t sim6502 SIM65FLAGS = -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) +ifdef CMD_EXE +RM := del /f +DIFF := fc +else RM := rm -f DIFF := diff -q +endif CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow -.PHONY: all +.PHONY: all clean REFS := $(patsubst %.c,%.ref,$(wildcard *.c)) diff --git a/test/todo b/test/todo index 911eacdd3..75245507e 100644 --- a/test/todo +++ b/test/todo @@ -1,10 +1,4 @@ -- the tests in ./misc need special care - - check all tests in ./ref and make them return their results as exit code -- in ./val use some other tool than "diff" for comparing the results - -- fixup makefiles to use "del" instead of "rm -f" on windows - - reduce usage of "common.h" to a minimum diff --git a/test/val/Makefile b/test/val/Makefile index 0e4a6e94c..e4841bd35 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -1,15 +1,23 @@ # makefile for the regression tests that return an error code on failure +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + CC65FLAGS = -t sim6502 SIM65FLAGS = -x 200000000 CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65) SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) +ifdef CMD_EXE +RM := del /f +else RM := rm -f +endif -.PHONY: all +.PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) From 0079f5f6a2c83eb0891a84f45087af1f5eb1a3ad Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 23 Nov 2014 12:31:47 +0100 Subject: [PATCH 13/22] checked tests in /val --- test/todo | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/todo b/test/todo index 75245507e..08f04ad79 100644 --- a/test/todo +++ b/test/todo @@ -1,4 +1,2 @@ -- check all tests in ./ref and make them return their results as exit code - - reduce usage of "common.h" to a minimum From e3fdbc0a4bf8832e230e011d8301ac60a48cd0f0 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 23 Nov 2014 12:50:47 +0100 Subject: [PATCH 14/22] removed common.h reference --- test/readme.txt | 7 +++++++ test/todo | 2 -- test/val/cc65091020.c | 3 +-- test/val/compare5.c | 5 ----- 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 test/todo diff --git a/test/readme.txt b/test/readme.txt index 673ecabdb..ca188878b 100644 --- a/test/readme.txt +++ b/test/readme.txt @@ -14,3 +14,10 @@ compiler. to run the tests use "make" in this (top) directory, the makefile should exit with no error. + +-------------------------------------------------------------------------------- + +TODO: + +- reduce usage of "common.h" to a minimum +- convert more tests from using reference output to returning an exit code diff --git a/test/todo b/test/todo deleted file mode 100644 index 08f04ad79..000000000 --- a/test/todo +++ /dev/null @@ -1,2 +0,0 @@ - -- reduce usage of "common.h" to a minimum diff --git a/test/val/cc65091020.c b/test/val/cc65091020.c index 8f62f970e..d23b70a06 100644 --- a/test/val/cc65091020.c +++ b/test/val/cc65091020.c @@ -5,8 +5,7 @@ !!AUTHOR!! Johan Kotlinski */ -#include "common.h" - +#include #include struct { diff --git a/test/val/compare5.c b/test/val/compare5.c index b0a9f1649..9e0c97a63 100644 --- a/test/val/compare5.c +++ b/test/val/compare5.c @@ -4,8 +4,6 @@ !!LICENCE!! GPL, read COPYING.GPL */ -#include "common.h" - #include #include @@ -19,9 +17,6 @@ unsigned char success = 0; unsigned char failures = 0; unsigned char dummy = 0; -#ifdef SUPPORT_BIT_TYPES -bit bit0 = 0; -#endif int int0 = 0; int int1 = 0; char char0 = 0; From a0a03e5f73fa9975e3f3adb2b033588f6cd9956d Mon Sep 17 00:00:00 2001 From: mrdudz Date: Mon, 24 Nov 2014 20:35:35 +0100 Subject: [PATCH 15/22] added linefeeds --- test/misc/endless.c | 2 +- test/ref/cf.in | 2 +- test/ref/yacc.in | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/misc/endless.c b/test/misc/endless.c index 7924d7902..fe0782941 100644 --- a/test/misc/endless.c +++ b/test/misc/endless.c @@ -10,4 +10,4 @@ int main(void) } printf("error: should not come here\n"); return EXIT_FAILURE; -} \ No newline at end of file +} diff --git a/test/ref/cf.in b/test/ref/cf.in index 1b0a6f23a..8190039e6 100755 --- a/test/ref/cf.in +++ b/test/ref/cf.in @@ -16,4 +16,4 @@ uniform of a tall African whose cheekbones were ridged with Joe boys," Ratz said, shoving a draft across the bar with his good hand. "Maybe some business with you, Case?" Case shrugged. The girl to his right giggled and nudged -< end cf.input \ No newline at end of file +< end cf.input diff --git a/test/ref/yacc.in b/test/ref/yacc.in index 79e716878..697b244d0 100755 --- a/test/ref/yacc.in +++ b/test/ref/yacc.in @@ -1,2 +1,3 @@ x=(e+1)*3/(3+7) - \ No newline at end of file + + From 8a558a7ceff17a380fb8930f7f1dc4db85d42d16 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Mon, 24 Nov 2014 20:57:58 +0100 Subject: [PATCH 16/22] use own naive bdiff tool instead of diff/fc --- test/Makefile | 23 ++++++++++++++++++++--- test/bdiff.c | 28 ++++++++++++++++++++++++++++ test/misc/Makefile | 4 ++-- test/ref/Makefile | 4 ++-- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 test/bdiff.c diff --git a/test/Makefile b/test/Makefile index d71d5fda4..f5f10c029 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,9 +3,26 @@ MAKE := make --no-print-dir -.PHONY: all clean +ifneq ($(shell echo),) + CMD_EXE = 1 +endif -all: +ifdef CMD_EXE +RM := del /f +EXE := .exe +else +RM := rm -f +EXE := +endif + +.PHONY: dotests clean + +all: dotests + +bdiff: + @$(CC) -o bdiff$(EXE) bdiff.c + +dotests: bdiff @$(MAKE) -C val clean all @$(MAKE) -C ref clean all @$(MAKE) -C err clean all @@ -16,4 +33,4 @@ clean: @$(MAKE) -C ref clean @$(MAKE) -C err clean @$(MAKE) -C misc clean - + @$(RM) bdiff$(EXE) diff --git a/test/bdiff.c b/test/bdiff.c new file mode 100644 index 000000000..797ba4302 --- /dev/null +++ b/test/bdiff.c @@ -0,0 +1,28 @@ + +// minimal tool to compare two binaries + +#include +#include + +int main(int argc, char *argv[]) +{ + FILE *f1, *f2; + if (argc < 3) { + return EXIT_FAILURE; + } + f1 = fopen(argv[1], "rb"); + f2 = fopen(argv[2], "rb"); + if ((f1 == NULL) || (f2 == NULL)) { + return EXIT_FAILURE; + } + for(;;) { + if (feof(f1) && feof(f2)) { + return EXIT_SUCCESS; + } else if (feof(f1) || feof(f2)) { + return EXIT_FAILURE; + } + if (fgetc(f1) != fgetc(f2)) { + return EXIT_FAILURE; + } + } +} diff --git a/test/misc/Makefile b/test/misc/Makefile index b9e4637d0..e3d60269d 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -13,12 +13,12 @@ SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) ifdef CMD_EXE RM := del /f -DIFF := fc else RM := rm -f -DIFF := diff -q endif +DIFF := ./../bdiff + .PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) diff --git a/test/ref/Makefile b/test/ref/Makefile index b3b555aef..ccb52c3ba 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -14,12 +14,12 @@ SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) ifdef CMD_EXE RM := del /f -DIFF := fc else RM := rm -f -DIFF := diff -q endif +DIFF := ./../bdiff + CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all clean From 9c03326360d2f8bc374b3a519a7529714bf0acb5 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 25 Nov 2014 12:56:45 +0100 Subject: [PATCH 17/22] use 'testwrk' dir for bdiff --- .gitignore | 1 + test/Makefile | 23 +++++++++++++++-------- test/err/Makefile | 2 ++ test/misc/Makefile | 4 +++- test/ref/Makefile | 4 +++- test/val/Makefile | 2 ++ 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 1d5928af7..196cdc3d7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ /mou/ /ser/ /targetutil/ +/testwrk/ /tgi/ /wrk/ diff --git a/test/Makefile b/test/Makefile index f5f10c029..be0360c41 100644 --- a/test/Makefile +++ b/test/Makefile @@ -8,21 +8,28 @@ ifneq ($(shell echo),) endif ifdef CMD_EXE -RM := del /f -EXE := .exe + RM := del /f + EXE := .exe + MKDIR = mkdir else -RM := rm -f -EXE := + RM := rm -f + EXE := + MKDIR = mkdir -p endif +WORKDIR := ../testwrk + .PHONY: dotests clean all: dotests -bdiff: - @$(CC) -o bdiff$(EXE) bdiff.c +$(WORKDIR): + @$(MKDIR) $(WORKDIR) -dotests: bdiff +$(WORKDIR)/bdiff$(EXE): $(WORKDIR) + @$(CC) -o $(WORKDIR)/bdiff$(EXE) bdiff.c + +dotests: $(WORKDIR)/bdiff$(EXE) @$(MAKE) -C val clean all @$(MAKE) -C ref clean all @$(MAKE) -C err clean all @@ -33,4 +40,4 @@ clean: @$(MAKE) -C ref clean @$(MAKE) -C err clean @$(MAKE) -C misc clean - @$(RM) bdiff$(EXE) + @$(RM) $(WORKDIR)/bdiff$(EXE) diff --git a/test/err/Makefile b/test/err/Makefile index 3ced60bc8..fd18bf752 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -15,6 +15,8 @@ else RM := rm -f endif +WORKDIR := ./../../testwrk + .PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) diff --git a/test/misc/Makefile b/test/misc/Makefile index e3d60269d..43cb6f576 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -17,7 +17,9 @@ else RM := rm -f endif -DIFF := ./../bdiff +WORKDIR := ./../../testwrk + +DIFF := $(WORKDIR)/bdiff .PHONY: all clean diff --git a/test/ref/Makefile b/test/ref/Makefile index ccb52c3ba..a8d87c4c3 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -18,7 +18,9 @@ else RM := rm -f endif -DIFF := ./../bdiff +WORKDIR := ./../../testwrk + +DIFF := $(WORKDIR)/bdiff CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow diff --git a/test/val/Makefile b/test/val/Makefile index e4841bd35..6a40feb61 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -17,6 +17,8 @@ else RM := rm -f endif +WORKDIR := ./../../testwrk + .PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) From 60026925addaf1202909159bd118cc33fb3adf2b Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 25 Nov 2014 13:47:31 +0100 Subject: [PATCH 18/22] use testwrk for binaries, and generated reference data --- test/Makefile | 3 ++ test/err/Makefile | 36 ++++++++++---------- test/misc/Makefile | 35 ++++++++++---------- test/ref/Makefile | 82 +++++++++++++++++++++++----------------------- test/val/Makefile | 36 ++++++++++---------- 5 files changed, 98 insertions(+), 94 deletions(-) diff --git a/test/Makefile b/test/Makefile index be0360c41..842985233 100644 --- a/test/Makefile +++ b/test/Makefile @@ -11,10 +11,12 @@ ifdef CMD_EXE RM := del /f EXE := .exe MKDIR = mkdir + RMDIR = rmdir else RM := rm -f EXE := MKDIR = mkdir -p + RMDIR = rmdir endif WORKDIR := ../testwrk @@ -41,3 +43,4 @@ clean: @$(MAKE) -C err clean @$(MAKE) -C misc clean @$(RM) $(WORKDIR)/bdiff$(EXE) + @$(RMDIR) $(WORKDIR) diff --git a/test/err/Makefile b/test/err/Makefile index fd18bf752..f7f41a03c 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -19,33 +19,33 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) +TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) all: $(TESTS) -%.prg: %.c +$(WORKDIR)/%.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.o.prg: %.c +$(WORKDIR)/%.o.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.os.prg: %.c +$(WORKDIR)/%.os.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.osi.prg: %.c +$(WORKDIR)/%.osi.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.osir.prg: %.c +$(WORKDIR)/%.osir.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.oi.prg: %.c +$(WORKDIR)/%.oi.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.oir.prg: %.c +$(WORKDIR)/%.oir.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ -%.or.prg: %.c +$(WORKDIR)/%.or.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ clean: - @$(RM) *.o - @$(RM) *.prg + @$(RM) $(TESTS) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) diff --git a/test/misc/Makefile b/test/misc/Makefile index 43cb6f576..ce1956d86 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -23,41 +23,42 @@ DIFF := $(WORKDIR)/bdiff .PHONY: all clean -TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) +TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) all: $(TESTS) # should compile, but then hangs in an endless loop -endless%prg: endless.c +$(WORKDIR)/endless%prg: endless.c $(CL65) $(CC65FLAGS) $< -o $@ ! $(SIM65) $(SIM65FLAGS) $@ # these need reference data that cant be generated by a host compiled program # in a useful way -limits%prg: limits.c +$(WORKDIR)/limits%prg: limits.c $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > limits.out - $(DIFF) limits.out limits.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out + $(DIFF) $(WORKDIR)/limits.out limits.ref # the rest are tests that fail currently for one reason or another -fields%prg: fields.c +$(WORKDIR)/fields%prg: fields.c @echo "FIXME: " $@ "will currently fail" $(CL65) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ -sitest%prg: sitest.c +$(WORKDIR)/sitest%prg: sitest.c @echo "FIXME: " $@ "will currently fail" -$(CL65) $(CC65FLAGS) $< -o $@ -$(SIM65) $(SIM65FLAGS) $@ clean: - @$(RM) *.o - @$(RM) *.prg - @$(RM) *.out + @$(RM) $(TESTS) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) + diff --git a/test/ref/Makefile b/test/ref/Makefile index a8d87c4c3..f14db3ecf 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -26,66 +26,66 @@ CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all clean -REFS := $(patsubst %.c,%.ref,$(wildcard *.c)) +REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) -TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) +TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) all: $(REFS) $(TESTS) -%.ref: %.c - $(CC) $(CFLAGS) $< -o $*.host - ./$*.host > $@ +$(WORKDIR)/%.ref: %.c + $(CC) $(CFLAGS) $< -o $(WORKDIR)/$*.host + $(WORKDIR)/$*.host > $@ -%.prg: %.c %.ref +$(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.o.prg: %.c %.ref +$(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.os.prg: %.c %.ref +$(WORKDIR)/%.os.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.osi.prg: %.c %.ref +$(WORKDIR)/%.osi.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.osir.prg: %.c %.ref +$(WORKDIR)/%.osir.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.oi.prg: %.c %.ref +$(WORKDIR)/%.oi.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.oir.prg: %.c %.ref +$(WORKDIR)/%.oir.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref -%.or.prg: %.c %.ref +$(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref $(CL65) $(CC65FLAGS) $< -o $@ - $(SIM65) $(SIM65FLAGS) $@ > $*.out - $(DIFF) $*.out $*.ref + $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out + $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref clean: - @$(RM) *.o - @$(RM) *.prg - @$(RM) *.out - @$(RM) *.ref - @$(RM) *.host + @$(RM) $(TESTS) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.host,$(wildcard *.c)) diff --git a/test/val/Makefile b/test/val/Makefile index 6a40feb61..591f95389 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -21,49 +21,49 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c)) +TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) +TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) all: $(TESTS) -%.prg: %.c +$(WORKDIR)/%.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.o.prg: %.c +$(WORKDIR)/%.o.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.os.prg: %.c +$(WORKDIR)/%.os.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.osi.prg: %.c +$(WORKDIR)/%.osi.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.osir.prg: %.c +$(WORKDIR)/%.osir.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.oi.prg: %.c +$(WORKDIR)/%.oi.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.oir.prg: %.c +$(WORKDIR)/%.oir.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ -%.or.prg: %.c +$(WORKDIR)/%.or.prg: %.c $(CL65) $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ clean: - @$(RM) *.o - @$(RM) *.prg + @$(RM) $(TESTS) + @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) From 5f727ea56b1e0fe21a31d75c1a160858a5693563 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 25 Nov 2014 14:16:39 +0100 Subject: [PATCH 19/22] removed binaries and references from git ignore --- test/.gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index 6ca887d5c..5761abcfd 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,5 +1 @@ *.o -*.prg -*.out -*.host -*.ref From 3e8ae54759757b441901f471f2a6c0c3ab5974bd Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Nov 2014 01:38:30 +0100 Subject: [PATCH 20/22] actually use optimization switches --- test/Makefile | 6 ++++++ test/err/Makefile | 14 +++++++------- test/misc/Makefile | 2 ++ test/ref/Makefile | 14 +++++++------- test/val/Makefile | 14 +++++++------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/test/Makefile b/test/Makefile index 842985233..b942cbcdf 100644 --- a/test/Makefile +++ b/test/Makefile @@ -37,6 +37,12 @@ dotests: $(WORKDIR)/bdiff$(EXE) @$(MAKE) -C err clean all @$(MAKE) -C misc clean all +continue: $(WORKDIR)/bdiff$(EXE) + @$(MAKE) -C val all + @$(MAKE) -C ref all + @$(MAKE) -C err all + @$(MAKE) -C misc all + clean: @$(MAKE) -C val clean @$(MAKE) -C ref clean diff --git a/test/err/Makefile b/test/err/Makefile index f7f41a03c..f0fcf3486 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -33,19 +33,19 @@ all: $(TESTS) $(WORKDIR)/%.prg: %.c ! $(CL65) $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.o.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -O $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.os.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Os $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.osi.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Osi $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.osir.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Osir $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.oi.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Oi $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.oir.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Oir $(CC65FLAGS) $< -o $@ $(WORKDIR)/%.or.prg: %.c - ! $(CL65) $(CC65FLAGS) $< -o $@ + ! $(CL65) -Or $(CC65FLAGS) $< -o $@ clean: @$(RM) $(TESTS) @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) diff --git a/test/misc/Makefile b/test/misc/Makefile index ce1956d86..0fa550d3f 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -32,6 +32,8 @@ TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +# FIXME: actually use/build differently optimized programs here + all: $(TESTS) # should compile, but then hangs in an endless loop diff --git a/test/ref/Makefile b/test/ref/Makefile index f14db3ecf..2a465b500 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -49,37 +49,37 @@ $(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -O $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.os.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Os $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.osi.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Osi $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.osir.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Osir $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.oi.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Oi $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.oir.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Oir $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref $(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Or $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out $(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref diff --git a/test/val/Makefile b/test/val/Makefile index 591f95389..2dc4796e6 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -37,31 +37,31 @@ $(WORKDIR)/%.prg: %.c $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.o.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -O $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.os.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Os $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.osi.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Osi $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.osir.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Osir $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.oi.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Oi $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.oir.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Oir $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ $(WORKDIR)/%.or.prg: %.c - $(CL65) $(CC65FLAGS) $< -o $@ + $(CL65) -Or $(CC65FLAGS) $< -o $@ $(SIM65) $(SIM65FLAGS) $@ clean: From 0387b8cf1df20990613af01da72d1986fbcf1920 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Nov 2014 14:22:22 +0100 Subject: [PATCH 21/22] added note on how to continue after failure, added missing limits.ref --- test/misc/limits.ref | 24 ++++++++++++++++++++++++ test/readme.txt | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 test/misc/limits.ref diff --git a/test/misc/limits.ref b/test/misc/limits.ref new file mode 100644 index 000000000..9be906beb --- /dev/null +++ b/test/misc/limits.ref @@ -0,0 +1,24 @@ +CHAR_MAX: 0x000000ff=255 +UCHAR_MAX: 0x000000ff=255 +SCHAR_MAX: 0x0000007f=127 +SHRT_MAX: 0x00007fff=32767 +USHRT_MAX: 0x0000ffff=-1 +SSHRT_MAX: 0x00007fff=32767 +INT_MAX: 0x00007fff=32767 +UINT_MAX: 0x0000ffff=-1 +SINT_MAX: 0x00007fff=32767 +LONG_MAX: 0x7fffffff=2147483647 +ULONG_MAX: 0xffffffff=-1 +SLONG_MAX: 0x7fffffff=2147483647 +CHAR_MIN: 0x00000000=0 +UCHAR_MIN: 0x00000000=0 +SCHAR_MIN: 0x0000ff80=-128 +SHRT_MIN: 0x00008000=-32768 +USHRT_MIN: 0x00000000=0 +SSHRT_MIN: 0x00008000=-32768 +INT_MIN: 0x00008000=-32768 +UINT_MIN: 0x00000000=0 +SINT_MIN: 0x00008000=-32768 +LONG_MIN: 0x80000000=-2147483648 +ULONG_MIN: 0x00000000=0 +SLONG_MIN: 0x80000000=-2147483648 diff --git a/test/readme.txt b/test/readme.txt index ca188878b..cd3b7501a 100644 --- a/test/readme.txt +++ b/test/readme.txt @@ -15,6 +15,8 @@ compiler. to run the tests use "make" in this (top) directory, the makefile should exit with no error. +when a test failed you can use "make continue" to run further tests + -------------------------------------------------------------------------------- TODO: From 92ed5fd64b0d9786fe3a3b59efd716d2855ad619 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Wed, 26 Nov 2014 19:32:54 +0100 Subject: [PATCH 22/22] scan sources just once --- test/err/Makefile | 19 ++++++++++--------- test/misc/Makefile | 21 +++++++++++---------- test/ref/Makefile | 25 +++++++++++++------------ test/val/Makefile | 19 ++++++++++--------- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/test/err/Makefile b/test/err/Makefile index f0fcf3486..40ccfcb59 100644 --- a/test/err/Makefile +++ b/test/err/Makefile @@ -19,14 +19,15 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(TESTS) @@ -48,4 +49,4 @@ $(WORKDIR)/%.or.prg: %.c ! $(CL65) -Or $(CC65FLAGS) $< -o $@ clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) diff --git a/test/misc/Makefile b/test/misc/Makefile index 0fa550d3f..b18d9165e 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -23,14 +23,15 @@ DIFF := $(WORKDIR)/bdiff .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) # FIXME: actually use/build differently optimized programs here @@ -60,7 +61,7 @@ $(WORKDIR)/sitest%prg: sitest.c clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) diff --git a/test/ref/Makefile b/test/ref/Makefile index 2a465b500..b752adc1d 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -28,14 +28,15 @@ CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(REFS) $(TESTS) @@ -85,7 +86,7 @@ $(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.out,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c)) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.host,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host) diff --git a/test/val/Makefile b/test/val/Makefile index 2dc4796e6..2e0aca278 100644 --- a/test/val/Makefile +++ b/test/val/Makefile @@ -21,14 +21,15 @@ WORKDIR := ./../../testwrk .PHONY: all clean -TESTS := $(patsubst %.c,$(WORKDIR)/%.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.o.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.os.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.osir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oi.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.oir.prg,$(wildcard *.c)) -TESTS += $(patsubst %.c,$(WORKDIR)/%.or.prg,$(wildcard *.c)) +SOURCES := $(wildcard *.c) +TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg) +TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg) all: $(TESTS) @@ -66,4 +67,4 @@ $(WORKDIR)/%.or.prg: %.c clean: @$(RM) $(TESTS) - @$(RM) $(patsubst %.c,$(WORKDIR)/%.o,$(wildcard *.c)) + @$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)