Changeset 90152a4 for tests/io2.c
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
tests/io2.c (moved) (moved from src/tests/io.c ) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/io2.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // io .c --8 // 6 // 7 // io2.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 11 08:53:41 201713 // Update Count : 8114 // 12 // Last Modified On : Thu May 24 21:17:41 2018 13 // Update Count : 103 14 // 15 15 16 #include <fstream> 16 #include <fstream.hfa> 17 18 #define xstr(s) str(s) 19 #define str(s) #s 17 20 18 21 int main() { 19 char c; // basic types 22 _Bool b; // basic types 23 char c; 20 24 signed char sc; 21 25 unsigned char usc; … … 37 41 char s1[size], s2[size]; 38 42 39 int x = 3, y = 5, z = 7; 40 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 41 sout | 1 | 2 | 3 | endl; 42 sout | '1' | '2' | '3' | endl; 43 sout | 1 | "" | 2 | "" | 3 | endl; 44 sout | endl; 45 46 sout | "opening delimiters" | endl; 47 sout 48 | "x (" | 1 49 | "x [" | 2 50 | "x {" | 3 51 | "x =" | 4 52 | "x $" | 5 53 | "x £" | 6 54 | "x ¥" | 7 55 | "x ¡" | 8 56 | "x ¿" | 9 57 | "x «" | 10 58 | endl | endl; 59 60 sout | "closing delimiters" | endl; 61 sout 62 | 1 | ", x" 63 | 2 | ". x" 64 | 3 | "; x" 65 | 4 | "! x" 66 | 5 | "? x" 67 | 6 | "% x" 68 | 7 | "¢ x" 69 | 8 | "» x" 70 | 9 | ") x" 71 | 10 | "] x" 72 | 11 | "} x" 73 | endl | endl; 74 75 sout | "opening/closing delimiters" | endl; 76 sout 77 | "x`" | 1 | "`x'" | 2 78 | "'x\"" | 3 | "\"x:" | 4 79 | ":x " | 5 | " x\t" | 6 80 | "\tx\f" | 7 | "\fx\v" | 8 81 | "\vx\n" | 9 | "\nx\r" | 10 82 | "\rx" 83 | endl | endl; 84 85 sout | "override opening/closing delimiters" | endl; 86 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 87 sout | endl; 88 89 ifstream in; // create / open file 90 open( &in, "io.data", "r" ); 43 ifstream in = { xstr(IN_DIR) "io.data" }; // create / open file 91 44 92 45 sout | "input bacis types" | endl; 93 &in | c | sc | usc // character 94 | si | usi | i | ui | li | uli | lli | ulli // integral 95 | f | d | ld // floating point 96 | fc | dc | ldc // floating-point complex 97 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 46 in | b // boolean 47 | c | sc | usc // character 48 | si | usi | i | ui | li | uli | lli | ulli // integral 49 | f | d | ld // floating point 50 | fc | dc | ldc // floating-point complex 51 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 98 52 sout | endl; 99 53 100 54 sout | "output basic types" | endl; 101 sout | c | ' ' | sc | ' ' | usc | endl // character 102 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 103 | f | d | ld | endl // floating point 104 | fc | dc | ldc | endl; // complex 55 sout | b | endl // boolean 56 | c | ' ' | sc | ' ' | usc | endl // character 57 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 58 | f | d | ld | endl // floating point 59 | fc | dc | ldc | endl; // complex 105 60 sout | endl; 106 61 … … 112 67 sout | "toggle separator" | endl; 113 68 sout | f | "" | d | "" | ld | endl // floating point without separator 114 | sepDisable | fc | dc | ldc | endl// complex without separator115 | fc | sepOn | dc | ldc | endl // local separator add116 | sepEnable | fc | dc | ldc | endl // complex with separator117 | fc | sepOff | dc | ldc | endl// local separator removal118 | s1 | sepOff | s2 | endl // local separator removal119 | s1 | "" | s2 | endl; // local separator removal69 | sepDisable | fc | dc | ldc | endl // complex without separator 70 | fc | sepOn | dc | ldc | endl // local separator add 71 | sepEnable | fc | dc | ldc | endl // complex with separator 72 | fc | sepOff | dc | ldc | endl // local separator removal 73 | s1 | sepOff | s2 | endl // local separator removal 74 | s1 | "" | s2 | endl; // local separator removal 120 75 sout | endl; 121 76 … … 125 80 sout | " to \"" | sep | "\"" | endl; 126 81 sout | f | d | ld | endl 127 | fc | dc | ldc | endl128 | s1 | s2 | endl129 | t1 | t2 | endl; // print tuple82 | fc | dc | ldc | endl 83 | s1 | s2 | endl 84 | t1 | t2 | endl; // print tuple 130 85 sout | endl; 131 86 sout | "from \"" | sep | "\" "; … … 133 88 sout | "to \"" | sep | "\"" | endl; 134 89 sout | f | d | ld | endl 135 | fc | dc | ldc | endl136 | s1 | s2 | endl137 | t1 | t2 | endl; // print tuple90 | fc | dc | ldc | endl 91 | s1 | s2 | endl 92 | t1 | t2 | endl; // print tuple 138 93 sout | endl; 139 94 … … 179 134 // Local Variables: // 180 135 // tab-width: 4 // 181 // compile-command: "cfa io .c" //136 // compile-command: "cfa io2.c" // 182 137 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.