Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
b42e495a
Commit
b42e495a
authored
Aug 21, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ tests for convert formula
parent
c8e29874
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+12
-0
cell/model/FormulaObjects/engineeringFunctions.js
cell/model/FormulaObjects/engineeringFunctions.js
+3
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
b42e495a
...
...
@@ -6878,6 +6878,18 @@ $( function () {
ok
(
oParser
.
parse
()
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.0154324
);
oParser
=
new
parserFormula
(
'
CONVERT(1, "lbm", "kg")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
()
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.4535923
);
oParser
=
new
parserFormula
(
'
CONVERT(1, "lbm", "mg")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
()
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
0
)
-
0
,
453592
);
oParser
=
new
parserFormula
(
'
CONVERT(1, "klbm", "mg")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
()
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
#N/A
"
);
}
);
test
(
"
Test:
\"
PRICE
\"
"
,
function
()
{
...
...
cell/model/FormulaObjects/engineeringFunctions.js
View file @
b42e495a
...
...
@@ -4984,7 +4984,9 @@
var
coeff
;
var
res
;
if
(
null
!==
(
coeff
=
getUnitConverterCoeff
(
from
,
to
))){
if
(
from
===
to
){
res
=
num
;
}
else
if
(
null
!==
(
coeff
=
getUnitConverterCoeff
(
from
,
to
))){
if
(
coeff
.
length
){
res
=
num
;
for
(
var
i
=
0
;
i
<
coeff
.
length
;
i
++
){
...
...
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