-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from KQMATH/feat/testing
Feat/testing
- Loading branch information
Showing
9 changed files
with
5,242 additions
and
1,498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
# Node | ||
node_modules | ||
dist | ||
lib | ||
npm-debug.log | ||
.env | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
require: [ | ||
"@babel/register" | ||
], | ||
babel: { | ||
extensions: ['js'] | ||
} | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @author André Storhaug <[email protected]> | ||
* @copyright 2019 NTNU | ||
*/ | ||
|
||
import test from 'ava'; | ||
import TeX2Max from '../index'; | ||
|
||
test.beforeEach(t => { | ||
t.context.TeX2Max = new TeX2Max(); | ||
}); | ||
|
||
function transpilation(t, input, expected) { | ||
let maximaCode = t.context.TeX2Max.toMaxima(input); | ||
t.is(maximaCode, expected); | ||
} | ||
|
||
transpilation.title = ( | ||
providedTitle = '', input, expected) => `${providedTitle} ${input}`.trim(); | ||
|
||
function singleVars(t, input, expected) { | ||
t.context.TeX2Max.updateOptions({ | ||
onlySingleVariables: true, | ||
addTimesSign: true, | ||
}); | ||
transpilation(t, input, expected); | ||
} | ||
|
||
singleVars.title = ( | ||
providedTitle = '', input, | ||
expected) => `SingleVars: ${providedTitle} ${input}`.trim(); | ||
|
||
test('Simple finite integral with numerical arguments', | ||
[transpilation, singleVars], | ||
'\\int_0^1xdx', 'integrate((x),x,(0),(1))'); | ||
|
||
test.failing('Simple finite integral with variable arguments', | ||
transpilation, | ||
'\\int_a^bxdx', 'integrate((x),x,(a),(b))'); | ||
|
||
test('Simple finite integral with variable arguments', | ||
singleVars, | ||
'\\int_a^bxdx', 'integrate((x),x,(a),(b))'); | ||
|
||
test('Simple finite integral with brackets around argument', | ||
[transpilation, singleVars], | ||
'\\int_0^1\\left(x\\right)dx', 'integrate(((x)),x,(0),(1))'); |
Oops, something went wrong.