Changeset eb68ebb
- Timestamp:
- Sep 7, 2017, 10:57:24 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 0cc818b
- Parents:
- f47ba55
- Location:
- src/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.expect/user_literals.txt
rf47ba55 reb68ebb 5 5 11.0714285714286 6 6 22.0457142857143 7 secs 1 8 secs 23 9 mins 23 10 hours 23 11 _A_ 23 12 _thingy_ 1234 13 secs 65535 14 mins 65535 15 hours 65535 16 _A_ 65535 17 _thingy_ 65535 18 secs 10 19 hours 10 20 mins 10 21 _A_ 10 22 _thingy_ 10 23 secs abc 24 mins 0x4058c6 25 hours 0x4058d0 26 _A_ 0x4058d0 27 _thingy_ abc -
src/tests/user_literals.c
rf47ba55 reb68ebb 10 10 // Created On : Wed Sep 6 21:40:50 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 6 23:19:08201713 // Update Count : 3 612 // Last Modified On : Thu Sep 7 22:53:49 2017 13 // Update Count : 39 14 14 // 15 15 16 16 #include <fstream> 17 #include <wchar.h> 18 #include <uchar.h> 19 20 int ?`s( int s ) { sout | "secs" | s | endl; } 21 int ?`m( int m ) { sout | "mins" | m | endl; } 22 int ?`h( int h ) { sout | "hours" | h | endl; } 23 int ?`_A_( int x ) { sout | "_A_" | x | endl; } 24 int ?`__thingy_( int x ) { sout | "_thingy_" | x | endl; } 25 26 int ?`s( const char * s ) { sout | "secs" | s | endl; } 27 int ?`m( const char16_t * m ) { sout | "mins" | m | endl; } 28 int ?`h( const char32_t * h ) { sout | "hours" | h | endl; } 29 int ?`_A_( const wchar_t * x ) { sout | "_A_" | x | endl; } 30 int ?`__thingy_( const char * x ) { sout | "_thingy_" | x | endl; } 31 17 32 18 33 struct Weight { … … 28 43 Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; } 29 44 Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; } 45 30 46 31 47 int main() { … … 43 59 w = 5`st + 8`kg + 25`lb + hw; 44 60 sout | w | endl; 45 }46 61 62 // 0`secs; 63 1`s; 64 23`s; 65 23u`m; 66 23l`h; 67 23_ul`_A_; 68 1_234_LL`__thingy_; 47 69 70 0xff_ffl; 71 0xff_ff`s; 72 0xff_ffu`m; 73 0xff_ffl`h; 74 0xff_fful`_A_; 75 0xff_ffLL`__thingy_; 76 77 '\n'`s; 78 L'\n'`h; 79 u'\n'`m; 80 L_'\n'`_A_; 81 U_'\n'`__thingy_; 82 83 "abc"`s; 84 u"abc"`m; 85 U_"abc"`h; 86 L"abc"`_A_; 87 u8_"abc"`__thingy_; 88 } // main 48 89 49 90 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.