aboutsummaryrefslogtreecommitdiffstats
path: root/cil/test/small1/wchar1.c
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-03-29 09:47:11 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-03-29 09:47:11 +0000
commita5f03d96eee482cd84861fc8cefff9eb451c0cad (patch)
treecbc66cbc183a7c5ef2c044ed9ed04b8011df9cd4 /cil/test/small1/wchar1.c
parenta9621943087a5578c995d88b06f87c5158eb5d00 (diff)
downloadcompcert-a5f03d96eee482cd84861fc8cefff9eb451c0cad.tar.gz
compcert-a5f03d96eee482cd84861fc8cefff9eb451c0cad.zip
Cleaned up configure script.
Distribution of CIL as an expanded source tree with changes applied (instead of original .tar.gz + patches to be applied at config time). git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1020 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/test/small1/wchar1.c')
-rw-r--r--cil/test/small1/wchar1.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/cil/test/small1/wchar1.c b/cil/test/small1/wchar1.c
new file mode 100644
index 00000000..3306e571
--- /dev/null
+++ b/cil/test/small1/wchar1.c
@@ -0,0 +1,24 @@
+#include "testharness.h"
+#include <stddef.h>
+
+int main() {
+ wchar_t *wbase = L"Hello" L", world";
+ char * w = (char *)wbase;
+ char * s = "Hello" ", world";
+ int i;
+
+ // See if this is little or big endian
+ short foo = 0x0011;
+ char little_endian = (int) * (char*)&foo;
+
+ for (i=0; i < 10; i++) {
+ if (w[i * sizeof(wchar_t)] != (little_endian ? s[i] : 0)) {
+ E(1);
+ }
+ if (w[i * sizeof(wchar_t) + (sizeof(wchar_t)-1)]
+ != (little_endian ? 0 : s[i])) {
+ E(2);
+ }
+ }
+ SUCCESS;
+}