- Timestamp:
- Sep 8, 2023, 12:46:55 AM (16 months ago)
- Branches:
- master
- Children:
- 553f032f
- Parents:
- 3ee8853
- Location:
- tests/io
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/io/.expect/manipulatorsInput.arm64.txt
r3ee8853 r2fa0237 1 pre1 "123456", canary ok 2 pre2a "1234567", exception occurred, canary ok 3 pre2b "89", canary ok 1 4 1 yyyyyyyyyyyyyyyyyyyy 2 5 2 abcxxx -
tests/io/.expect/manipulatorsInput.x64.txt
r3ee8853 r2fa0237 1 pre1 "123456", canary ok 2 pre2a "1234567", exception occurred, canary ok 3 pre2b "89", canary ok 1 4 1 yyyyyyyyyyyyyyyyyyyy 2 5 2 abcxxx -
tests/io/.expect/manipulatorsInput.x86.txt
r3ee8853 r2fa0237 1 pre1 "123456", canary ok 2 pre2a "1234567", exception occurred, canary ok 3 pre2b "89", canary ok 1 4 1 yyyyyyyyyyyyyyyyyyyy 2 5 2 abcxxx -
tests/io/.in/manipulatorsInput.txt
r3ee8853 r2fa0237 1 123456 2 123456789 1 3 abc 2 4 abc -
tests/io/manipulatorsInput.cfa
r3ee8853 r2fa0237 15 15 16 16 int main() { 17 { 18 // Upfront checks to ensure buffer safety. Once these pass, the simpler `wdi(sizeof(s),s)` 19 // usage, as in the scanf alignment cases below, is justified. 20 struct { 21 char buf[8]; 22 char canary; 23 } data; 24 static_assert( sizeof(data.buf) == 8 ); 25 static_assert( &data.buf[8] == &data.canary ); // canary comes right after buf 26 27 void rep(const char* casename) { 28 data.canary = 42; 29 bool caught = false; 30 try { 31 sin | wdi( sizeof(data.buf), data.buf ); 32 } catch (cstring_length*) { 33 caught = true; 34 } 35 printf( "%s \"%s\"", casename, data.buf ); 36 if ( caught ) { 37 printf(", exception occurred"); 38 } 39 if ( data.canary == 42 ) { 40 printf(", canary ok"); 41 } else { 42 printf(", canary overwritten to %d", data.canary); 43 } 44 printf("\n"); 45 } 46 47 rep("pre1"); 48 rep("pre2a"); 49 rep("pre2b"); 50 scanf("\n"); // next test does not start with %s so does not tolerate leading whitespace 51 } 17 52 { 18 53 char s[] = "yyyyyyyyyyyyyyyyyyyy";
Note: See TracChangeset
for help on using the changeset viewer.