Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
2a392918
Commit
2a392918
authored
Dec 13, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил тесты iobase для работы в 64bit
parent
b9c92a58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
libuniset2.spec
conf/libuniset2.spec
+1
-0
test_iobase_with_sm.cc
extensions/tests/test_iobase_with_sm.cc
+15
-9
No files found.
conf/libuniset2.spec
View file @
2a392918
...
...
@@ -506,6 +506,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# history of current unpublished changes
# Modbus: refactoring code and test (for 64bit)
# iobase: refactoring tests for 64bit
%changelog
* Mon Dec 12 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt6
...
...
extensions/tests/test_iobase_with_sm.cc
View file @
2a392918
#include <catch.hpp>
// -----------------------------------------------------------------------------
#include <memory>
#include <cmath>
#include "Exceptions.h"
#include "Extensions.h"
#include "tests_with_sm.h"
...
...
@@ -17,6 +18,11 @@ static void init_test()
CHECK
(
shm
!=
nullptr
);
}
// -----------------------------------------------------------------------------
static
float
myRound
(
float
v
,
size_t
delim
)
{
return
(
std
::
round
(
v
*
delim
)
/
(
float
)
delim
);
}
// -----------------------------------------------------------------------------
static
bool
init_iobase
(
IOBase
*
ib
,
const
std
::
string
&
sensor
)
{
init_test
();
...
...
@@ -262,7 +268,7 @@ TEST_CASE("[IOBase::calibration]: AI calibration", "[iobase][calibration][ai][ex
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
99.5
f
);
shm
->
setValue
(
ai
,
994
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
99.4
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
10
)
==
99.4
f
);
}
SECTION
(
"AI calibration rawdata=1 (asAI)"
)
...
...
@@ -374,19 +380,19 @@ TEST_CASE("[IOBase::calibration]: AI calibration (precision)", "[iobase][calibra
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
0
);
shm
->
setValue
(
ai
,
-
990
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
-
0.99
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
1000
)
==
-
0.99
f
);
shm
->
setValue
(
ai
,
-
995
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
-
0.995
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
1000
)
==
-
0.995
f
);
shm
->
setValue
(
ai
,
1000
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
1.0
f
);
shm
->
setValue
(
ai
,
995
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
0.995
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
1000
)
==
0.995
f
);
shm
->
setValue
(
ai
,
994
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
0.994
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
1000
)
==
0.994
f
);
}
SECTION
(
"AI calibration noprecision=1 (FasAO)"
)
...
...
@@ -397,19 +403,19 @@ TEST_CASE("[IOBase::calibration]: AI calibration (precision)", "[iobase][calibra
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
0
);
shm
->
setValue
(
ai
,
-
990
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
-
99.0
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
100
)
==
-
99.0
f
);
shm
->
setValue
(
ai
,
-
995
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
-
99.5
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
100
)
==
-
99.5
f
);
shm
->
setValue
(
ai
,
1000
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
100.0
f
);
shm
->
setValue
(
ai
,
995
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
99.5
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
100
)
==
99.5
f
);
shm
->
setValue
(
ai
,
994
);
REQUIRE
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
)
==
99.4
f
);
REQUIRE
(
myRound
(
IOBase
::
processingFasAO
(
&
ib
,
shm
,
true
),
100
)
==
99.4
f
);
ib
.
noprecision
=
false
;
}
...
...
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