From 954b47fecdae7366802af7b6a4a5c7a1edce2ba1 Mon Sep 17 00:00:00 2001 From: D-T-666 Date: Sat, 17 Oct 2020 22:53:55 +0400 Subject: [PATCH 1/7] added 4 test and an "=" in binaryComplement1sFunc --- mathgenerator/mathgen.py | 2 +- tests/test_mathgen.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 02b4c1d..b1ce210 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -70,7 +70,7 @@ def binaryComplement1sFunc(maxDigits = 10): question += temp answer += "0" if temp == "1" else "1" - problem = question + problem = question+"=" solution = answer return problem, solution diff --git a/tests/test_mathgen.py b/tests/test_mathgen.py index ace72a5..2d6e590 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -39,8 +39,42 @@ def test_moduloFunc(maxRes, maxModulo): assert eval(problem[:-1]) == int(solution) +@given(maxDigits=st.integers(min_value=1, max_value=16)) +def test_binaryComplement1sFunc(maxDigits): + assume(maxDigits > 1) + problem, solution = binaryComplement1sFunc(maxDigits) + assert "".join('1' if i == '0' else '0' for i in problem[:-1]) == solution + + @given(minNo=st.integers(min_value=1), maxNo=st.integers(min_value=1, max_value=2 ** 50)) def test_squareRootFunc(minNo, maxNo): assume(maxNo > minNo) problem, solution = squareRootFunc(minNo, maxNo) assert eval(problem[:-1]) == float(solution) + + +@given(maxSquareNum=st.integers(min_value=1)) +def test_squareFunc(maxSquareNum): + assume(maxSquareNum > 1) + problem, solution = squareFunc(maxSquareNum) + assert pow(int(problem[:-3]), 2) == int(solution) + + +@given(maxVal=st.integers(min_value=1)) +def test_lcmFunc(maxVal): + assume(maxVal > 1) + problem, solution = lcmFunc(maxVal) + split_arr = problem.split(' ') + mult = int(split_arr[2])*int(split_arr[4]) + assert mult if mult != pow(int(split_arr[2]), 2) else int( + split_arr[2]) == int(solution) + + +@given(maxVal=st.integers(min_value=1)) +def test_gcdFunc(maxVal): + assume(maxVal > 1) + problem, solution = gcdFunc(maxVal) + split_arr = problem.split(' ') + mult = int(split_arr[2])*int(split_arr[4]) + assert mult if mult != pow(int(split_arr[2]), 2) else int( + split_arr[2]) == int(solution) \ No newline at end of file From e416d597fa2c8e287fe562f99c454e7eb3cd5925 Mon Sep 17 00:00:00 2001 From: D-T-666 Date: Sat, 17 Oct 2020 22:55:04 +0400 Subject: [PATCH 2/7] fixed whitespaces --- mathgenerator/mathgen.py | 4 ++-- tests/test_mathgen.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index b1ce210..390bc96 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -116,7 +116,7 @@ def gcdFunc(maxVal=20): x, y = a, b while(y): x, y = y, x % y - problem = f"GCD of {a} and {b} = " + problem = f"GCD of {a} and {b} =" solution = str(x) return problem, solution @@ -128,7 +128,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/tests/test_mathgen.py b/tests/test_mathgen.py index 2d6e590..a6aa078 100644 --- a/tests/test_mathgen.py +++ b/tests/test_mathgen.py @@ -77,4 +77,4 @@ def test_gcdFunc(maxVal): split_arr = problem.split(' ') mult = int(split_arr[2])*int(split_arr[4]) assert mult if mult != pow(int(split_arr[2]), 2) else int( - split_arr[2]) == int(solution) \ No newline at end of file + split_arr[2]) == int(solution) From f8318be9776731db46be03fe86347b9184462e13 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 19:16:29 -0400 Subject: [PATCH 3/7] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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', From 07314e280d4dc336edf206567629d8c4504c3641 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 21:15:10 -0400 Subject: [PATCH 4/7] Update issue templates --- .github/ISSUE_TEMPLATE/new-generator-idea.md | 16 ++++++++++++++++ .../request-changes-to-a-generator.md | 12 ++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/new-generator-idea.md create mode 100644 .github/ISSUE_TEMPLATE/request-changes-to-a-generator.md 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/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:** From 83e31cdce738ec7b52dd52d29b961529d89306a2 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 21:16:44 -0400 Subject: [PATCH 5/7] Update issue templates --- .github/ISSUE_TEMPLATE/custom-issue.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/custom-issue.md diff --git a/.github/ISSUE_TEMPLATE/custom-issue.md b/.github/ISSUE_TEMPLATE/custom-issue.md new file mode 100644 index 0000000..77fd3e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom-issue.md @@ -0,0 +1,10 @@ +--- +name: Custom Issue +about: If your issue lies outside of the other templates +title: '' +labels: '' +assignees: '' + +--- + + From 7802bdbdb428e24d3d73c213992c496df332cfb6 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Sat, 17 Oct 2020 21:18:08 -0400 Subject: [PATCH 6/7] Update issue templates --- .github/ISSUE_TEMPLATE/other-issue.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/other-issue.md 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: '' + +--- + + From 4331db74d0010319fa50707798700f2d1a3fef35 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Sat, 17 Oct 2020 21:20:20 -0400 Subject: [PATCH 7/7] Remove custom issue template --- .github/ISSUE_TEMPLATE/custom-issue.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/custom-issue.md diff --git a/.github/ISSUE_TEMPLATE/custom-issue.md b/.github/ISSUE_TEMPLATE/custom-issue.md deleted file mode 100644 index 77fd3e9..0000000 --- a/.github/ISSUE_TEMPLATE/custom-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Custom Issue -about: If your issue lies outside of the other templates -title: '' -labels: '' -assignees: '' - ---- - -