PHP language tests (units)

I am currently working (just for fun) on a compiler that breaks PHPdown-code into low-level source code VM.

Since the type system and many functions are PHPnot so logical, I need a lot of tests to verify that my code behaves like in PHP.

I started testing everything with the test from PHP-sources ( here ). But many tests are not only specific to the language, but also contain some processing functions of the web server (POST data, etc.). Are there any other tests for testing PHPas a language? It would be best if the script itself is written to PHP.

+3
source share
2 answers

If you verify that your semantics behave the same as in the Zend PHP implementation, I would recommend creating an automated tool for generating grammar from BNF from PHP itself. This way you will have many .php files expressing most of the semantics. Remember to include a lot of trace code in the generated files.

Then run it through the Zend implementation and yours to make sure you get the same check. Use incorrect code generation so you catch it too. Only when you know that your implementation is correct (with quirks) can you move on.

http://llvm.org/devmtg/2008-08/Lopes_PHP-JIT-InTwoDays.pdf . , PHP JIT LLVM. , .

+1

, , , ?
http://www.simpletest.org/

JUnit, php, .

0

Source: https://habr.com/ru/post/1708033/


All Articles