summaryrefslogtreecommitdiff
path: root/Compiler.Testing/SanityTests.cs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-09-05 10:20:03 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-09-05 10:20:03 +1000
commit9e8ba6e00dc4a4137a5187dbe5fe5b1394219735 (patch)
treee5a54706a8a85243fdb0fe0f2ed73fb7b7566bcd /Compiler.Testing/SanityTests.cs
parent4ea967c6089bbcaba5d71145546d288e186fba40 (diff)
stuff
Diffstat (limited to 'Compiler.Testing/SanityTests.cs')
-rw-r--r--Compiler.Testing/SanityTests.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Compiler.Testing/SanityTests.cs b/Compiler.Testing/SanityTests.cs
new file mode 100644
index 0000000..46c0323
--- /dev/null
+++ b/Compiler.Testing/SanityTests.cs
@@ -0,0 +1,43 @@
+namespace Compiler.Testing;
+
+using Q1;
+
+[TestFixture]
+public class SanityTests
+{
+ [Test]
+ public void BlankProgram()
+ {
+ string program = """
+ int main() { }
+ """;
+
+ string result = TestingHelpers.CompileString(program).Trim();
+ Assert.That(
+ result, Is.EqualTo(
+ """
+ jmp _main
+ _main:
+ mov 0, V0
+ ret
+ """));
+ }
+
+ [Test]
+ public void ReturnConstant()
+ {
+ string program = """
+ int main() { return 42; }
+ """;
+
+ string result = TestingHelpers.CompileString(program).Trim();
+ Assert.That(
+ result, Is.EqualTo(
+ """
+ jmp _main
+ _main:
+ mov 42, V0
+ ret
+ """));
+ }
+} \ No newline at end of file