Changeset 679


Ignore:
Timestamp:
Apr 27, 2003, 1:33:35 AM (18 years ago)
Author:
orlov
Message:
  • Some additional tests.
Location:
to-imperative/trunk/samples/Convert
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/samples/Convert/to_int.cc

    r673 r679  
    1919
    2020RF_FUNC (Main, (), (RF_RES _v_res1))
     21  Expr _v_To_m_Int1;
     22  if (RF_CALL (Convert::To_m_Int, (ShortInt::create_expr(32) + ShortInt::create_expr(6)), (_v_To_m_Int1)))
    2123  {
     24    RF_CALL (StdIO::PrintLN, (_v_To_m_Int1), ());
     25    Expr _v_To_m_Int2;
     26    if (RF_CALL (Convert::To_m_Int, (ShortInt::create_expr(-6) + ShortInt::create_expr(36)), (_v_To_m_Int2)))
    2227    {
    23       Expr _v_To_m_Int1;
    24       if (RF_CALL (Convert::To_m_Int, (ShortInt::create_expr(+32) + ShortInt::create_expr(6)), (_v_To_m_Int1)))
     28      RF_CALL (StdIO::PrintLN, (_v_To_m_Int2), ());
     29      Expr _v_To_m_Int3;
     30      if (RF_CALL (Convert::To_m_Int, (Char::create_expr("-12") + ShortInt::create_expr(34)), (_v_To_m_Int3)))
    2531      {
    26         RF_CALL (StdIO::PrintLN, (_v_To_m_Int1), ());
    27         Expr _v_To_m_Int2;
    28         if (RF_CALL (Convert::To_m_Int, (ShortInt::create_expr(-6) + ShortInt::create_expr(36)), (_v_To_m_Int2)))
     32        RF_CALL (StdIO::PrintLN, (_v_To_m_Int3), ());
     33        Expr _v_To_m_Int4;
     34        if (RF_CALL (Convert::To_m_Int, (Char::create_expr("+326")), (_v_To_m_Int4)))
    2935        {
    30           RF_CALL (StdIO::PrintLN, (_v_To_m_Int2), ());
    31           Expr _v_To_m_Int3;
    32           if (RF_CALL (Convert::To_m_Int, (Char::create_expr("-") + Char::create_expr("1") + Char::create_expr("2") + ShortInt::create_expr(34)), (_v_To_m_Int3)))
     36          RF_CALL (StdIO::PrintLN, (_v_To_m_Int4), ());
     37          Expr _v_To_m_Int5;
     38          if (RF_CALL (Convert::To_m_Int, (ShortInt::create_expr(0) + Char::create_expr("0123") + ShortInt::create_expr(0) + Char::create_expr("0678")), (_v_To_m_Int5)))
    3339          {
    34             RF_CALL (StdIO::PrintLN, (_v_To_m_Int3), ());
    35             Expr _v_To_m_Int4;
    36             if (RF_CALL (Convert::To_m_Int, (Char::create_expr("+") + Char::create_expr("3") + Char::create_expr("2") + Char::create_expr("6")), (_v_To_m_Int4)))
    37             {
    38               _v_res1 = empty;
    39               RF_TAILCALL (StdIO::PrintLN, (_v_To_m_Int4), ());
    40             }
    41             goto LBranch1;
     40            _v_res1 = empty;
     41            RF_TAILCALL (StdIO::PrintLN, (_v_To_m_Int5), ());
    4242          }
    43           goto LBranch1;
     43          error ("Unexpected fail");
    4444        }
    45         goto LBranch1;
     45        error ("Unexpected fail");
    4646      }
    47       goto LBranch1;
     47      error ("Unexpected fail");
    4848    }
    49   LBranch1: {}
    5049    error ("Unexpected fail");
    5150  }
    52 LBlock1: {}
    53   return true;
     51  error ("Unexpected fail");
    5452RF_END
    5553
  • to-imperative/trunk/samples/Convert/to_int.rf

    r651 r679  
    22$use StdIO;
    33
    4 Main = {
    5          <PrintLN <To-Int +32 006>>,
    6          <PrintLN <To-Int -6 36>>,
    7          <PrintLN <To-Int '-12' 34>>,
    8          <PrintLN <To-Int '+326'>>;
    9        };
     4Main =
     5  <PrintLN <To-Int +32 006>>,
     6  <PrintLN <To-Int -6 36>>,
     7  <PrintLN <To-Int '-12' 34>>,
     8  <PrintLN <To-Int '+326'>>,
     9  <PrintLN <To-Int 0 '0123' 0 '0678'>>;
Note: See TracChangeset for help on using the changeset viewer.