2013-12-28 15:09:52 -08:00
|
|
|
#include "spec_helper.h"
|
2014-01-08 18:35:16 -08:00
|
|
|
#include "document.h"
|
|
|
|
|
|
|
|
|
|
extern TSParseConfig ts_parse_config_arithmetic;
|
2013-12-17 13:14:41 -08:00
|
|
|
|
2013-12-28 15:09:52 -08:00
|
|
|
START_TEST
|
2013-12-17 13:14:41 -08:00
|
|
|
|
2013-12-28 15:09:52 -08:00
|
|
|
describe("arithmetic", []() {
|
2014-01-09 13:31:30 -08:00
|
|
|
TSDocument *document;
|
|
|
|
|
|
|
|
|
|
before_each([&]() {
|
|
|
|
|
document = TSDocumentMake();
|
2014-01-08 18:35:16 -08:00
|
|
|
TSDocumentSetUp(document, ts_parse_config_arithmetic);
|
2014-01-09 13:31:30 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("parses variables", [&]() {
|
|
|
|
|
TSDocumentSetText(document, "x");
|
|
|
|
|
AssertThat(string(TSDocumentToString(document)), Equals("(expression (term (factor (variable))))"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("parses products of variables", [&]() {
|
|
|
|
|
TSDocumentSetText(document, "x*y");
|
|
|
|
|
AssertThat(string(TSDocumentToString(document)), Equals("(expression (term (factor (number)) (factor (number)))"));
|
2013-12-28 15:09:52 -08:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
END_TEST
|