Replies: 2 comments 8 replies
-
Thanks David! It it a good idea to implement something to automatically test the embedded docs for errors. There is something similar in place to test the comments that are used to generate the docs on the website. Is this something you would like to give a go? |
Beta Was this translation helpful? Give feedback.
6 replies
-
I was checking if all functions that are in the parser have docs and found the following that does not:
I'm not familiar with some of them, does it make sense for them to be in the parser without docs? To replicate type on the Demo
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just today I started working with embedded docs. At some point I thought of testing if my examples on the embedded docs worked. And ended up doing something like this.
math.evaluate(math.help(math.add).doc.examples)
A few times I have found that the examples throw an error. So I tested something automatic and found the following functions have errors in their examples
diff
diff([1, 2, 4, 7, 0], 0)
RangeError: Cannot have negative dimension
diff
diff([[1, 2], [3, 4]], 0)
RangeError: Cannot have negative dimension
evaluate
evaluate("sqrt(" + 4 + ")")
Error: Cannot convert "sqrt(" to a number
invmod
invmod(8, 12)=NaN
SyntaxError: Invalid left hand side of assignment operator = (char 14)
invmod
invmod(7, 13)=2
SyntaxError: Invalid left hand side of assignment operator = (char 14)
invmod
invmod(15151, 15122)=10429
SyntaxError: Invalid left hand side of assignment operator = (char 21)
lyap
lyap(A,Q)
Error: Undefined symbol Q
numeric
numeric("4", "Fraction)
SyntaxError: End of string " expected (char 24)
numeric
numeric(fraction(2, 5), "number)
SyntaxError: End of string " expected (char 33)
polynomialRoot
a = polynomialRoot(-6, 11, -6 1)
SyntaxError: Parenthesis ) expected (char 31)
schur
schur(A)
TypeError: Unexpected type of argument in function schur (expected: Array or Matrix, actual: Unit | identifier, index: 0)
simplifyConstant
simplifyConatant("(3-3)*x")
Error: Undefined function simplifyConatant
sylvester
sylvester(A,B,C)
TypeError: Unexpected type of argument in function sylvester (expected: Array or Matrix, actual: Unit | identifier, index: 0)
typed
double("hello")
Error: Cannot convert "hello" to a number
To replicate this you only need to go into the parser of mathjs home and type
help
for the specific function in the parserNow, some of these are simple typos or maybe a copy paste from the not embedded docs.
I would like to discuss the possibility of automatic testing for the examples.
Beta Was this translation helpful? Give feedback.
All reactions