From: michaelh Date: Sat, 25 Aug 2001 03:51:00 +0000 (+0000) Subject: Added simple static array init test X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4fa0b6f47e6ea278ef3392be0948b25d20e0ef9a;p=fw%2Fsdcc Added simple static array init test git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1168 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/support/regression/tests/staticinit.c b/support/regression/tests/staticinit.c new file mode 100644 index 00000000..794b729e --- /dev/null +++ b/support/regression/tests/staticinit.c @@ -0,0 +1,44 @@ +/** Tests that the static initialiser code works. + As the init code is now clever we have to be careful. + + type: char, int, long +*/ +#include + +static {type} smallDense[] = { + 1, 2, 3, 4, 5, 6 +}; + +static void +testSmallDense(void) +{ + ASSERT(smallDense[0] == 1); + ASSERT(smallDense[1] == 2); + ASSERT(smallDense[2] == 3); + ASSERT(smallDense[3] == 4); + ASSERT(smallDense[4] == 5); + ASSERT(smallDense[5] == 6); +} + +static {type} smallSparse[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + +static void +testSmallSparse(void) +{ + ASSERT(smallSparse[0] == 1); + ASSERT(smallSparse[1] == 1); + ASSERT(smallSparse[2] == 1); + ASSERT(smallSparse[3] == 1); + ASSERT(smallSparse[4] == 1); + ASSERT(smallSparse[5] == 1); + ASSERT(smallSparse[6] == 1); + ASSERT(smallSparse[7] == 1); + ASSERT(smallSparse[8] == 1); +} + +static {type} smallSparseZero[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +