diff --git a/.github/ISSUE_TEMPLATE/new-generator-idea.md b/.github/ISSUE_TEMPLATE/new-generator-idea.md new file mode 100644 index 0000000..b986c9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-generator-idea.md @@ -0,0 +1,16 @@ +--- +name: New Generator Idea +about: Use this template if you have an idea for a new generator. +title: '' +labels: New generator, hacktoberfest +assignees: '' + +--- + +**Example Problem:** + +**Example Solution:** + +**Further explanation:** + +**Would you like to be assigned to this:** diff --git a/.github/ISSUE_TEMPLATE/other-issue.md b/.github/ISSUE_TEMPLATE/other-issue.md new file mode 100644 index 0000000..7b37378 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other-issue.md @@ -0,0 +1,10 @@ +--- +name: Other Issue +about: If your issue lies outside of the other templates +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md b/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md new file mode 100644 index 0000000..9fa48e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md @@ -0,0 +1,12 @@ +--- +name: Request changes to a generator +about: If you find a faulty generator that needs a fix, use this template. +title: '' +labels: bug, hacktoberfest +assignees: '' + +--- + +**Name or Id of generator:** + +**Issue:** diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 402b513..12a3f16 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -78,7 +78,7 @@ def binaryComplement1sFunc(maxDigits=10): question += temp answer += "0" if temp == "1" else "1" - problem = question + problem = question+"=" solution = answer return problem, solution @@ -142,7 +142,7 @@ def lcmFunc(maxVal=20): while(y): x, y = y, x % y d = c // x - problem = f"LCM of {a} and {b} = " + problem = f"LCM of {a} and {b} =" solution = str(d) return problem, solution diff --git a/setup.py b/setup.py index 4a578ab..0b546c2 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='mathgenerator', - version='1.1.2', + version='1.1.3', description='An open source solution for generating math problems', url='https://github.com/todarith/mathgenerator', author='Luke Weiler', diff --git a/tests/test_mathgen.py b/tests/test_mathgen.py index af38bff..7555131 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -1,46 +1,46 @@ -from math import sqrt -from mathgenerator.mathgen import * - -from hypothesis import strategies as st, given, assume - - -@given(maxSum=st.integers(min_value=1), maxAddend=st.integers(min_value=1)) -def test_addition(maxSum, maxAddend): - assume(maxSum > maxAddend) - problem, solution = addition.func(maxSum, maxAddend) - assert eval(problem[:-1]) == int(solution) - - -@given(maxMinuend=st.integers(min_value=1), maxDiff=st.integers(min_value=1)) -def test_subtraction(maxMinuend, maxDiff): - assume(maxMinuend > maxDiff) - problem, solution = subtraction.func(maxMinuend, maxDiff) - assert eval(problem[:-1]) == int(solution) - - -@given(maxRes=st.integers(min_value=1), maxMulti=st.integers(min_value=1)) -def test_multiplication(maxRes, maxMulti): - assume(maxRes > maxMulti) - problem, solution = multiplication.func(maxRes, maxMulti) - assert eval(problem[:-1]) == int(solution) - - -@given(maxRes=st.integers(min_value=1), maxDivid=st.integers(min_value=1)) -def test_division(maxRes, maxDivid): - assume(maxRes > maxDivid) - problem, solution = division.func(maxRes, maxDivid) - assert eval(problem[:-1]) == float(solution) - - -@given(maxRes=st.integers(min_value=1), maxModulo=st.integers(min_value=1)) -def test_moduloDivision(maxRes, maxModulo): - assume(maxRes > maxModulo) - problem, solution = moduloDivision.func(maxRes, maxModulo) - assert eval(problem[:-1]) == int(solution) - - -@given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) -def test_squareRoot(minNo, maxNo): - assume(maxNo > minNo) - problem, solution = squareRoot.func(minNo, maxNo) - assert eval(problem[:-1]) == float(solution) +from math import sqrt +from mathgenerator.mathgen import * + +from hypothesis import strategies as st, given, assume + + +@given(maxSum=st.integers(min_value=1), maxAddend=st.integers(min_value=1)) +def test_addition(maxSum, maxAddend): + assume(maxSum > maxAddend) + problem, solution = addition.func(maxSum, maxAddend) + assert eval(problem[:-1]) == int(solution) + + +@given(maxMinuend=st.integers(min_value=1), maxDiff=st.integers(min_value=1)) +def test_subtraction(maxMinuend, maxDiff): + assume(maxMinuend > maxDiff) + problem, solution = subtraction.func(maxMinuend, maxDiff) + assert eval(problem[:-1]) == int(solution) + + +@given(maxRes=st.integers(min_value=1), maxMulti=st.integers(min_value=1)) +def test_multiplication(maxRes, maxMulti): + assume(maxRes > maxMulti) + problem, solution = multiplication.func(maxRes, maxMulti) + assert eval(problem[:-1]) == int(solution) + + +@given(maxRes=st.integers(min_value=1), maxDivid=st.integers(min_value=1)) +def test_division(maxRes, maxDivid): + assume(maxRes > maxDivid) + problem, solution = division.func(maxRes, maxDivid) + assert eval(problem[:-1]) == float(solution) + + +@given(maxRes=st.integers(min_value=1), maxModulo=st.integers(min_value=1)) +def test_moduloDivision(maxRes, maxModulo): + assume(maxRes > maxModulo) + problem, solution = moduloDivision.func(maxRes, maxModulo) + assert eval(problem[:-1]) == int(solution) + + +@given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) +def test_squareRoot(minNo, maxNo): + assume(maxNo > minNo) + problem, solution = squareRoot.func(minNo, maxNo) + assert eval(problem[:-1]) == float(solution)