Fixed warning: "_POSIX_C_SOURCE" redefined and removed old tests.

parent 4ffbcb2c
......@@ -310,8 +310,11 @@ class Parser(BisonParser):
# raw lex script, verbatim here
# -----------------------------------------
lexscript = r"""
%{
%top{
#include "Python.h"
}
%{
#define YYSTYPE void *
#include "tokens.h"
extern void *py_parser;
......
import unittest
from src.calc import Parser
from tests.parser import run_expressions
from sympy import Symbol, symbols
class TestVariables(unittest.TestCase):
def test_addition(self):
expressions = [('5 + 5', 5 + 5)]
run_expressions(Parser, expressions)
def test_addition_of_one_term(self):
a = Symbol('a')
expressions = [('a + 5', 5 + a)]
run_expressions(Parser, expressions)
def test_addition_of_two_terms(self):
a, b = symbols('a,b')
expressions = [('4*a + 5*b', 4 * a + 5 * b)]
run_expressions(Parser, expressions)
#def test_short_addition_of_two_terms(self):
# a, b = symbols('a,b')
# expressions = [('4a + 5b', 4.0*a + 5.0*b)]
# run_expressions(expressions, verbose=1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment