mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-09 23:43:16 +02:00
Add basic tests
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YesNt.Interpreter.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class CodeFlowTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void FunctionTest()
|
||||
{
|
||||
List<string> lines = new List<string>()
|
||||
{
|
||||
"cal yes",
|
||||
"fnc yes",
|
||||
"!<result = 1",
|
||||
"ret",
|
||||
">result"
|
||||
};
|
||||
YesNtAssert.IsLastLineEqual(lines, "1");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LabelsTest()
|
||||
{
|
||||
List<string> lines = new List<string>()
|
||||
{
|
||||
"<result = 1",
|
||||
"jmp yes",
|
||||
"<result = 0",
|
||||
"lbl yes",
|
||||
">result"
|
||||
};
|
||||
YesNtAssert.IsLastLineEqual(lines, "1");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CalculationsTest()
|
||||
{
|
||||
Assert.Inconclusive();
|
||||
YesNtAssert.IsLineEqual("10 * 10 !calc", (20).ToString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user