scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0051-wmemmove.c (468B)


      1 #include <assert.h>
      2 #include <stdio.h>
      3 #include <wchar.h>
      4 
      5 /*
      6 output:
      7 testing
      8 done
      9 end:
     10 */
     11 
     12 int
     13 main()
     14 {
     15 	wchar_t buf[30];
     16 	wchar_t def[] = {'d', 'e', 'f', '\0'};
     17 	wchar_t abc[] = {'a', 'b', 'c', '\0'};
     18 	wchar_t abcdef[]  = {'a', 'b', 'c', 'd', 'e', 'f', '\0'};
     19 
     20 	puts("testing");
     21 
     22 	wmemcpy(buf, abcdef, 6);
     23 	assert(!wmemcmp(wmemmove(buf, buf+3, 3), def, 3));
     24 	wmemcpy(buf, abcdef, 6);
     25 	assert(!wmemcmp(wmemmove(buf, buf+3, 0), abc, 3));
     26 
     27 	puts("done");
     28 
     29 	return 0;
     30 }