symbol test added

This commit is contained in:
avinal
2020-08-10 12:22:50 +05:30
parent 04d41a9a9e
commit 66617585ae

24
tests/symbol_test.cpp Normal file
View File

@@ -0,0 +1,24 @@
#include "catch/catch.hpp"
#include "../include/symbol_table.hpp"
symbol_table table;
TEST_CASE("Add a Symbol")
{
table.add_entry("avii", 47);
table.add_entry("krish", 7);
table.add_entry("cosmos", 0);
table.add_entry("noone", 90);
REQUIRE(table.contains("avii"));
REQUIRE(table.contains("krish"));
REQUIRE(table.contains("cosmos"));
REQUIRE(table.contains("noone"));
}
TEST_CASE("Get Address")
{
REQUIRE(table.get_address("avii") == 47);
REQUIRE(table.get_address("krish") == 7);
REQUIRE(table.get_address("cosmos") == 0);
REQUIRE(table.get_address("noone") == 90);
}