Comments (8)
Marking this as small because I don't think you have to know much about the code to do this, but it does touch a lot of code so in that sense it's not that small.
from mathsteps.
Can I be assigned for this?
from mathsteps.
Yes! Thanks :)
from mathsteps.
Work in progress just wanted to confirm that this is how the blueprint would look like for the util functions after reducing the code in tests :
'use strict';
const {canSimplifyPolynomialTerms} = require('../../lib/checks');
const {simplifyPolynomial} = require('../TestUtil');
function testCanCombine(exprStr, canCombine) {
simplifyPolynomial(canSimplifyPolynomialTerms, exprStr, canCombine);
}
describe('canSimplifyPolynomialTerms multiplication', function() {
const tests = [
['x^2 * x * x', true],
// false b/c coefficient
['x^2 * 3x * x', false],
['y * y^3', true],
['5 * y^3', false], // just needs flattening
['5/7 * x', false], // just needs flattening
['5/7 * 9 * x', false],
];
tests.forEach(t => testCanCombine(t[0], t[1]));
});
For testing the substeps ,
function testCollectAndCombineSubsteps(exprString, outputList, outputStr) {
testCACS(collectAndCombineSearch, exprString, outputList, outputStr);
}
This also eliminates the additional imports in all the test files. Placing all of them in a single util file For eg -
require('assert');
require('math');
require('print');
require('flatten');
Let me know about your thoughts on this and I would create a new branch for all the changes to be merged into the master. Also that I have written the test coverage for other functions that are separated, should I merge them along?
Here is the current coverage summary :
=============================== Coverage summary ===============================
Statements : 93.75% ( 2458/2622 )
Branches : 87.34% ( 1069/1224 )
Functions : 98.94% ( 186/188 )
Lines : 93.74% ( 2439/2602 )
================================================================================
from mathsteps.
testCanCombine
is a little different because it's not comparing nodes/strings, it's checking true/false. I think you should probably leave that test the way it is for now, or come up with a general function that would be used like:
function testCanCombine(exprStr, canCombine) {
TestUtil.testBooleanFunction(canSimplifyPolynomialTerms, exprStr, canCombine);
}
(not sure if testBooleanFunction
is the best name, but it's all I could think of right now)
for substeps, I'd expect:
function testCollectAndCombineSubsteps(exprString, outputList, outputStr) {
TestUtil.testSubsteps(collectAndCombineSearch, exprString, outputList, outputStr);
}
I think it'd be best if you put up your code in a pull request and we can talk about it there - will be easier to point out things :)
Also that I have written the test coverage for other functions that are separated, should I merge them along?
That's awesome! That's related to an assigned issue #58, so I'd say put it up in a separate pull request from this change to add the TestUtil
- make sense?
Let me know if you have any questions!
from mathsteps.
I'll write a more general method for
I think you should probably leave that test the way it is for now, or come up with a general function that would be used like:
Right now I am clearing my messy code. But soon it will be up for the PR.
That's awesome! That's related to an assigned issue #58, so I'd say put it up in a separate pull request from this change to add the TestUtil - make sense?
Your point is valid.
from mathsteps.
sounds good. looking forward to the PR!
from mathsteps.
done! thanks so much @nitin42
from mathsteps.
Related Issues (20)
- Can mathsteps handle derivative and integral? HOT 6
- x * (x - 1) = 1 ===>> throws 'Math error: No term with symbol: x , returning no steps' HOT 1
- How to run mathsteps on smartphone? HOT 1
- Severe security vulnerability HOT 5
- Missing parentheses when multiplying with a negative number HOT 5
- more things to add to linter
- Current Limitations HOT 1
- Mathsteps cannot handle quadratic equations HOT 4
- Development Status HOT 1
- handling latex input
- Script to browserify mathsteps
- compute a reverse expression HOT 1
- Fails when left node is only a parenthesis (eg "(x+1)=4", "((x)/(4))=4")
- Canceling out first variable throws error
- How to render these steps using Mathjax or something else? HOT 1
- Project Status and inactive email HOT 2
- bug : x-2/3=0
- Another bug : 2/x=3/4 HOT 2
- Adapting to iOS Swift
- Adapt README.md to link to the most active fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathsteps.