mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge https://github.com/Swayam221/mathgenerator into swayam
This commit is contained in:
16
.github/ISSUE_TEMPLATE/new-generator-idea.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/new-generator-idea.md
vendored
Normal file
@@ -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:**
|
||||
10
.github/ISSUE_TEMPLATE/other-issue.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/other-issue.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Other Issue
|
||||
about: If your issue lies outside of the other templates
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md
vendored
Normal file
12
.github/ISSUE_TEMPLATE/request-changes-to-a-generator.md
vendored
Normal file
@@ -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:**
|
||||
@@ -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
|
||||
|
||||
|
||||
2
setup.py
2
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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user