pike.git / src / testsuite.in

version» Context lines:

pike.git/src/testsuite.in:1: - test_true([["$Id: testsuite.in,v 1.586 2003/03/29 10:52:29 marcus Exp $"]]); + test_true([["$Id: testsuite.in,v 1.587 2003/04/08 14:23:16 mast Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])      cond([[all_constants()->_verify_internals]],   [[    test_do(_verify_internals())   ]]);   test_eq(1e1,10.0);   test_eq(1E1,10.0);
pike.git/src/testsuite.in:703:    if (mixed err = eat_stack()) {    catch (err[1] = err[1][sizeof (err[1]) - 50..]);    throw (err);    }    }    };       Top();   ]]);    - // Testing stack popping in the tail recursion opcodes + // Testing stack popping wrt the various function call opcodes   test_program([[    inherit Thread.Mutex : monitor;    int f (int x)    {    if(monitor::trylock(1))    return 0;    return x;    }    int a()    {
pike.git/src/testsuite.in:974:    foreach (({0, monitor::lock()}), mixed m) {    a (1); // F_RECUR_AND_POP    return iter;    }    }    }   ]]);   test_do(add_constant("f"))   test_do(add_constant("monitor"))    + // Testing scoped frames wrt the various function call opcodes + test_program([[ +  int f (int x) +  { +  return x; +  } +  int a (void|int x) +  { +  function s = lambda () {return x;}; +  return f (1); // F_CALL_LFUN_AND_RETURN +  }; + ]]); + test_program([[ +  int f (int x) +  { +  return x; +  }; +  mixed g = f; +  int a (void|int x) +  { +  function s = lambda () {return x;}; +  return g (1); // F_CALL_FUNCTION_AND_RETURN +  } + ]]); + test_program([[ +  int f (int x) +  { +  return x; +  } +  int a() +  { +  add_constant ("f", f); +  return compile_string(#" +  int g (void|int x) +  { +  function s = lambda () {return x;}; +  return f (1); // F_APPLY_AND_RETURN +  }")()->g(); +  } + ]]); + test_program([[ +  int iter = 0; +  int a (void|int x) +  { +  if (iter == 1) { +  return x; +  } +  else { +  function s = lambda () {return x;}; +  iter = 1; +  return a (1); // F_COND_RECUR +  } +  } + ]]); + test_program([[ +  int iter = 0; +  int a (void|int x) +  { +  if (!iter) { +  iter = 1; +  return a (x); +  } +  else if (iter == 2) { +  return x; +  } +  else { +  function s = lambda () {return x;}; +  iter = 2; +  return a (1); // F_TAIL_RECUR +  } +  } + ]]); + test_program([[ +  int iter = 0; +  int a (void|int x) +  { +  if (!iter) { +  iter = 1; +  return a (x); +  } +  else if (iter == 2) { +  return x; +  } +  else { +  function s = lambda () {return x;}; +  iter = 2; +  int res = a (1); // F_RECUR +  iter = -1; +  return res; +  } +  } + ]]); + test_program([[ +  int iter = 0; +  int a (void|int x) +  { +  if (!iter) { +  iter = 1; +  return a (x); +  } +  else if (iter == 2) { +  iter = x; +  } +  else { +  function s = lambda () {return x;}; +  iter = 2; +  a (1); // F_RECUR_AND_POP +  return iter; +  } +  } + ]]); + test_do(add_constant("f")) +    test_false([[object_variablep(class X { int y; int z() { return 1; }}(),"foo")]])   test_false([[object_variablep(class X { int y; int z() { return 1; }}(),"z")]])   test_true([[object_variablep(class X { int y; int z() { return 1; }}(),"y")]])      test_any([[ int a,b; [a,b]=({1,2}); return a]],1)   test_any([[ int a,b; [a,b]=({1,2}); return b]],2)   test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return a]],1)   test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return b]],2)   test_any([[ int a; catch { [a]=({1,2}); }; return 1]],1)   test_any([[ int a,b; catch { [a,b]=({1}); }; return 1]],1)