From df0a4187859662dbac31ecf36f50dc743863a2e3 Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Tue, 28 May 2024 01:35:13 -0400 Subject: [PATCH] money where the mouth is, make damn sure it works. --- tests/Feature/ProcessCodeTest.php | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/Feature/ProcessCodeTest.php diff --git a/tests/Feature/ProcessCodeTest.php b/tests/Feature/ProcessCodeTest.php new file mode 100644 index 0000000..3029c71 --- /dev/null +++ b/tests/Feature/ProcessCodeTest.php @@ -0,0 +1,69 @@ +setCode($code); + $compiler->processCode(); + $this->assertTrue($code == $compiler->getCode()); + + $code = "#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; + $compiler->setCode($code); + $compiler->processCode(); + $this->assertTrue($code == $compiler->getCode()); + + $code = "I can write anything wheeeee!#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; + $compiler->setCode($code); + $compiler->processCode(); + $this->assertTrue($code == $compiler->getCode()); + } + + public function test_valid_white_space_macros(): void + { + $compiler = new Compiler(); + + $code = "\t #define OLC_PGE_APPLICATION\n"; + $compiler->setCode($code); + $compiler->processCode(); + print_r($code); + print_r($compiler->getCode()); + $this->assertTrue($code != $compiler->getCode()); + + $code = "# define OLC_PGE_APPLICATION\n"; + $compiler->setCode($code); + $compiler->processCode(); + $this->assertTrue($code != $compiler->getCode()); + + $code = "#define OLC_PGE_APPLICATION\n"; + $compiler->setCode($code); + $compiler->processCode(); + $this->assertTrue($code != $compiler->getCode()); + + $code = "#define OLC_PGE_APPLICATION \n"; + $compiler->setCode($code); + $compiler->processCode(); + $this->assertTrue($code != $compiler->getCode()); + } + + // public function test_process_code_fails_on_bad_macro(): void + // { + // $compiler = new Compiler(); + + // $code = "I can write anything wheeeee!#define OLC_PGE_APPLICATIONYEAAAAAAA\n"; + // $compiler->setCode($code); + // $compiler->processCode(); + + // $this->assertTrue($code == $compiler->getCode()); + // } + +}