Skip to content

Commit

Permalink
Add tests for \sqrt's optional argument (ForNeVeR#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Sep 17, 2018
1 parent c59be1e commit 9009f8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/WpfMath.Tests/ParserTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ let ``\sqrt should parse arguments properly``(text : string) : unit =
<| text
<| (formula (row <| seq { yield upcast radical(char '1'); yield! ``123`` }))

[<Theory>]
[<InlineData(@"\sqrt [2]1123");
InlineData(@"\sqrt [ 2]{1}123");
InlineData(@"\sqrt[2 ] 1123");
InlineData(@"\sqrt[ 2 ] {1}123")>]
let ``\sqrt should parse optional argument properly``(text : string) : unit =
assertParseResult
<| text
<| (formula (row <| seq { yield upcast radicalWithDegree (char '2') (char '1'); yield! ``123`` }))

[<Theory>]
[<InlineData(@"\underline1123");
InlineData(@"\underline{1}123");
Expand Down
1 change: 1 addition & 0 deletions src/WpfMath.Tests/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ let symbol (name : string) : SymbolAtom = symbolSrc name TexAtomType.BinaryOpera
let symbolOp (name : string) : SymbolAtom = SymbolAtom(null, name, TexAtomType.BigOperator, false)
let underline(body : Atom) : UnderlinedAtom = UnderlinedAtom(null, body)
let radical(body : Atom) : Radical = Radical(null, body)
let radicalWithDegree (degree : Atom) (body : Atom) : Radical = Radical(null, body, degree)
let row (children : Atom seq) : RowAtom = rowSrc children null
let fenced left body right : FencedAtom = FencedAtom(null, body, left, right)
let fraction (num : Atom) (denom : Atom) : FractionAtom = FractionAtom(null, num, denom, true)
Expand Down

0 comments on commit 9009f8e

Please sign in to comment.