Skip to content

Physical quantitiy <= fix #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ app/benchmark.py
*.wpr
*.wpu
app/profiling_examples.py

.idea/
2 changes: 1 addition & 1 deletion app/context/physical_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def less_than_node(criterion, parameters, label=None):

def less_than_or_equal_node(criterion, parameters, label=None):
# TODO: Add nodes for the equal case
graph = comparison_base_graph(criterion, parameters, comparison_operator=">=", label=label)
graph = comparison_base_graph(criterion, parameters, comparison_operator="<=", label=label)
return graph


Expand Down
Empty file added app/tests/__init__.py
Empty file.
60 changes: 60 additions & 0 deletions app/tests/physical_quantity_evaluation_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,66 @@ def test_quantity_with_multiple_of_positive_value(self):
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_quantity_response_less_than_answer(self):
ans = "15 Hz"
res = "10 Hz"
params = {
"strict_syntax": False,
"physical_quantity": True,
"elementary functions": True,
"criteria": "response < answer"
}
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_quantity_response_greater_than_equal_answer(self):
ans = "5 Hz"
res = "10 Hz"
params = {
"strict_syntax": False,
"physical_quantity": True,
"elementary functions": True,
"criteria": "response >= answer"
}
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_quantity_response_greater_than_equal_answer_equal(self):
ans = "10 Hz"
res = "10 Hz"
params = {
"strict_syntax": False,
"physical_quantity": True,
"elementary functions": True,
"criteria": "response >= answer"
}
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_quantity_response_less_than_equal_answer(self):
ans = "15 Hz"
res = "10 Hz"
params = {
"strict_syntax": False,
"physical_quantity": True,
"elementary functions": True,
"criteria": "response <= answer"
}
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_quantity_response_less_than_equal_answer_equal(self):
ans = "10 Hz"
res = "10 Hz"
params = {
"strict_syntax": False,
"physical_quantity": True,
"elementary functions": True,
"criteria": "response <= answer"
}
result = evaluation_function(res, ans, params, include_test_data=True)
assert result["is_correct"] is True

def test_radians_to_frequency(self):
ans = "2*pi*f radian/second"
res = "f Hz"
Expand Down