-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(tests): update tests to new import structure
- Loading branch information
Showing
6 changed files
with
18 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from rajinipp.runner import RppRunner | ||
|
||
runner = RppRunner() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
from . import runner | ||
from rajinipp import rpp | ||
|
||
|
||
def test_conditional_exprs(cond_code, capsys): | ||
runner.exec(cond_code) | ||
rpp.exec(cond_code) | ||
out, err = capsys.readouterr() | ||
assert "x ( 15.0 ) is equal to 15!" in out.strip() | ||
|
||
|
||
def test_logical_exprs(logic_code, capsys): | ||
runner.exec(logic_code) | ||
rpp.exec(logic_code) | ||
out, err = capsys.readouterr() | ||
assert "x != b: True" in out.strip() | ||
|
||
|
||
def test_math_exprs(math_code, capsys): | ||
runner.exec(math_code) | ||
rpp.exec(math_code) | ||
out, err = capsys.readouterr() | ||
assert "modvar = 1.0" in out.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
from . import runner | ||
from rajinipp import rpp | ||
|
||
|
||
def test_if(cond_code, capsys): | ||
runner.exec(cond_code) | ||
rpp.exec(cond_code) | ||
out, err = capsys.readouterr() | ||
assert "x ( 15.0 ) is equal to 15!" in out.strip() | ||
|
||
|
||
def test_if_else(if_else_code, capsys): | ||
runner.exec(if_else_code) | ||
rpp.exec(if_else_code) | ||
out, err = capsys.readouterr() | ||
assert "x ( 5.0 ) is less than 10!" in out.strip() | ||
|
||
|
||
def test_for_loop(for_loop_code, capsys): | ||
runner.exec(for_loop_code) | ||
rpp.exec(for_loop_code) | ||
out, err = capsys.readouterr() | ||
assert "After loop: X = 14.0" in out.strip() | ||
|
||
|
||
def test_while_loop(while_loop_code, capsys): | ||
runner.exec(while_loop_code) | ||
rpp.exec(while_loop_code) | ||
out, err = capsys.readouterr() | ||
assert "breaking out of loop..." in out.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from . import runner | ||
from rajinipp import rpp | ||
|
||
|
||
def test_function(fn_code, capsys): | ||
runner.exec(fn_code) | ||
rpp.exec(fn_code) | ||
out, err = capsys.readouterr() | ||
assert "Hello from myfunc_one!" in out.strip() | ||
|
||
|
||
def test_function_return(fn_return_code, capsys): | ||
runner.exec(fn_return_code) | ||
rpp.exec(fn_return_code) | ||
out, err = capsys.readouterr() | ||
assert "Value returned from myfunc_one: 100.0" in out.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from . import runner | ||
from rajinipp import rpp | ||
|
||
|
||
def test_print(hello_world, capsys): | ||
runner.exec(hello_world) | ||
rpp.exec(hello_world) | ||
out, err = capsys.readouterr() | ||
assert out.strip() == "Hello, World!" | ||
|
||
|
||
def test_multi_print(multi_print, capsys): | ||
runner.exec(multi_print) | ||
rpp.exec(multi_print) | ||
out, err = capsys.readouterr() | ||
assert out.strip() == "5 + 5 = 10.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from . import runner | ||
from rajinipp import rpp | ||
|
||
|
||
def test_exec(hello_world, capsys): | ||
runner.exec(hello_world) | ||
rpp.exec(hello_world) | ||
out, err = capsys.readouterr() | ||
assert out.strip() == "Hello, World!" | ||
|
||
|
||
def test_eval(): | ||
out = runner.eval("5+5;") | ||
out = rpp.eval("5+5;") | ||
assert out == 10.0 |