Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
cassiopee
jalhyd
Commits
11a9ac1a
Commit
11a9ac1a
authored
Sep 24, 2020
by
Dorchies David
Browse files
test: improve checkResultConsistency function to explore children results
Refs
#276
parent
22207cba
Changes
1
Hide whitespace changes
Inline
Side-by-side
spec/test_func.ts
View file @
11a9ac1a
...
...
@@ -232,14 +232,29 @@ export function compareTwoResults(rTest: Result, rRef: Result, prec: number = Ma
}
export
function
checkResultConsistency
(
nub
:
Nub
,
r
?:
Result
)
{
let
bExploreChildren
:
boolean
=
false
;
if
(
r
===
undefined
)
{
r
=
nub
.
result
;
bExploreChildren
=
true
;
}
check1ResultConsistency
(
r
,
nub
.
calcType
!==
CalculatorType
.
SectionParametree
&&
nub
.
calcType
!==
CalculatorType
.
Grille
);
if
(
bExploreChildren
)
{
checkChildrenResultConsistency
(
nub
);
}
}
function
checkChildrenResultConsistency
(
nub
:
Nub
)
{
if
(
nub
.
getChildren
().
length
>
0
)
{
for
(
const
child
of
nub
.
getChildren
())
{
check1ResultConsistency
(
child
.
result
);
checkChildrenResultConsistency
(
child
);
}
}
}
function
check1ResultConsistency
(
r
:
Result
,
bTestvCalc
:
boolean
=
false
)
{
if
(
r
.
ok
)
{
if
(
nub
.
calcType
!==
CalculatorType
.
SectionParametree
&&
nub
.
calcType
!==
CalculatorType
.
Grille
)
{
if
(
bTestvCalc
)
{
// Pas de vCalc sur les sections paramétrées ni sur les grilles
expect
(
isFiniteNumber
(
r
.
vCalc
))
.
toBe
(
true
,
`vCalc =
${
r
.
vCalc
}
isn't a finite number`
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment