Skip to content

Commit

Permalink
Add << and >> to the constant fold test.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbiggar committed Feb 10, 2009
1 parent b4ba91e commit ccf5745
Show file tree
Hide file tree
Showing 2 changed files with 352 additions and 16 deletions.
17 changes: 13 additions & 4 deletions misc/constant_fold_test_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

$scalars = array ("0", "1", "5", "-1", "-10000", "true", "false", "\"String\"", "\"num3\"", "\"3\"", "6.702", "40.4e3", "0x786F");

$bin_ops = array ("+", "-", "/", "*", "%", "^", "&", "|", ".", "==", "===", "!=", "<>", "!==", "<=", ">=", "&&", "||");
$bin_ops = array ("+", "-", "/", "*", "%", "^", "&", "|", ".", "==", "===", "!=", "<>", "!==", "<=", ">=", "&&", "||", "<<", ">>");

$unary_ops = array ( "~", "!");


// These ops dont really make sense, and probably dont even parse (using a const on lhs)
// $bad_ops = array ( "++", "--", "<<", ">>", "+=", "-=", "*=", "/=", ".=",
// $bad_ops = array ( "+=", "-=", "*=", "/=", ".=",
// "%=", "&=", "|=", "^=", "<<=", ">>=");


Expand Down Expand Up @@ -48,14 +49,16 @@
// Create test files
$good = join ("\n", $good);
$good = "<?php\n$good\n?>";
file_put_contents ("test/subjects/parsing/constant_folding.php", $good);
$filename = "test/subjects/parsing/constant_folding.php";
file_put_contents ($filename, $good);

$i = 0;
foreach ($bad as $b)
{
list ($string, $out, $err, $exit) = $b;
$out = trim ($out);
$out = homogenize_all ($out);
$out = homogenize_all ($out, $filename);
$out = convert_to_phc_annotation ($out);

// make an error template
$string = "<?php\n"
Expand Down Expand Up @@ -90,6 +93,12 @@ function test ($str)
}
}

function convert_to_phc_annotation ($string)
{
$string = preg_replace ("/Warning/", "phc-warning", $string);
return $string;
}



?>
Loading

0 comments on commit ccf5745

Please sign in to comment.