buffalo
Loading...
Searching...
No Matches
buffalo.test.cpp
Go to the documentation of this file.
1#include <gtest/gtest.h>
2#include <buffalo/buffalo.h>
3
4TEST(Parser, Construction)
5{
6 auto parser = bf::SLRParser<G>::Build(statement);
7 ASSERT_TRUE(parser.has_value());
8}
9
10TEST(Parser, Evaluation)
11{
12 auto parser = *bf::SLRParser<G>::Build(statement);
13
14 auto res = parser.Parse("3 * 3 + 4^2 - (9 / 3)");
15 ASSERT_TRUE(res.has_value());
16
17 ASSERT_EQ(res->GetValue(), 22.0);
18}
TEST(Parser, Construction)
static std::expected< SLRParser, Error > Build(NonTerminal< G > &start)
Definition buffalo.h:1361