From 66617585ae178dad0cde1e5c1f375d3d31593fb2 Mon Sep 17 00:00:00 2001 From: avinal <185067@nith.ac.in> Date: Mon, 10 Aug 2020 12:22:50 +0530 Subject: [PATCH] symbol test added --- tests/symbol_test.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/symbol_test.cpp diff --git a/tests/symbol_test.cpp b/tests/symbol_test.cpp new file mode 100644 index 0000000..d108de7 --- /dev/null +++ b/tests/symbol_test.cpp @@ -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); +} \ No newline at end of file