Changeset eb68ebb


Ignore:
Timestamp:
Sep 7, 2017, 10:57:24 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
0cc818b
Parents:
f47ba55
Message:

extend test program

Location:
src/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/user_literals.txt

    rf47ba55 reb68ebb  
    5511.0714285714286
    6622.0457142857143
     7secs 1
     8secs 23
     9mins 23
     10hours 23
     11_A_ 23
     12_thingy_ 1234
     13secs 65535
     14mins 65535
     15hours 65535
     16_A_ 65535
     17_thingy_ 65535
     18secs 10
     19hours 10
     20mins 10
     21_A_ 10
     22_thingy_ 10
     23secs abc
     24mins 0x4058c6
     25hours 0x4058d0
     26_A_ 0x4058d0
     27_thingy_ abc
  • src/tests/user_literals.c

    rf47ba55 reb68ebb  
    1010// Created On       : Wed Sep  6 21:40:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep  6 23:19:08 2017
    13 // Update Count     : 36
     12// Last Modified On : Thu Sep  7 22:53:49 2017
     13// Update Count     : 39
    1414//
    1515
    1616#include <fstream>
     17#include <wchar.h>
     18#include <uchar.h>
     19
     20int ?`s( int s ) { sout | "secs" | s | endl; }
     21int ?`m( int m ) { sout | "mins" | m | endl; }
     22int ?`h( int h ) { sout | "hours" | h | endl; }
     23int ?`_A_( int x ) { sout | "_A_" | x | endl; }
     24int ?`__thingy_( int x ) { sout | "_thingy_" | x | endl; }
     25
     26int ?`s( const char * s ) { sout | "secs" | s | endl; }
     27int ?`m( const char16_t * m ) { sout | "mins" | m | endl; }
     28int ?`h( const char32_t * h ) { sout | "hours" | h | endl; }
     29int ?`_A_( const wchar_t * x ) { sout | "_A_" | x | endl; }
     30int ?`__thingy_( const char * x ) { sout | "_thingy_" | x | endl; }
     31
    1732
    1833struct Weight {
     
    2843Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; }
    2944Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; }
     45
    3046
    3147int main() {
     
    4359    w = 5`st + 8`kg + 25`lb + hw;
    4460    sout | w | endl;
    45 }
    4661
     62//      0`secs;
     63        1`s;
     64        23`s;
     65        23u`m;
     66        23l`h;
     67        23_ul`_A_;
     68        1_234_LL`__thingy_;
    4769
     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
    4889
    4990// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.