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
fa795f3d
Commit
fa795f3d
authored
Oct 20, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UniXML): исправил ошибку в реализации фунции getPIntProp()
для отрицательных чисел и нуля.
parent
f769de6a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
libuniset2.spec
conf/libuniset2.spec
+4
-1
UniXML.cc
src/Various/UniXML.cc
+5
-4
tests_unixml.xml
tests/tests_unixml.xml
+1
-1
unixml.cc
tests/unixml.cc
+2
-0
No files found.
conf/libuniset2.spec
View file @
fa795f3d
...
...
@@ -11,7 +11,7 @@
Name: libuniset2
Version: 2.0
Release: alt
8
Release: alt
9
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -404,6 +404,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc
%changelog
* Mon Oct 20 2014 Pavel Vainerman <pv@altlinux.ru> 2.0-alt9
- fixed bug in UniXML::iterator getPIntProp() for prop<=0
* Wed Oct 08 2014 Pavel Vainerman <pv@altlinux.ru> 2.0-alt8
- added unit-tests (use "catch" test unit framework)
- added use autoconf testsuite
...
...
src/Various/UniXML.cc
View file @
fa795f3d
...
...
@@ -134,7 +134,7 @@ int UniXML::getIntProp(const xmlNode* node, const string& name )
int
UniXML
::
getPIntProp
(
const
xmlNode
*
node
,
const
string
&
name
,
int
def
)
{
string
param
=
getProp
(
node
,
name
);
string
param
(
getProp
(
node
,
name
)
);
if
(
param
.
empty
()
)
return
def
;
...
...
@@ -410,10 +410,11 @@ int UniXML_iterator::getIntProp( const string& name )
int
UniXML_iterator
::
getPIntProp
(
const
string
&
name
,
int
def
)
{
int
i
=
getIntProp
(
name
);
if
(
i
<=
0
)
string
param
(
getProp
(
name
)
);
if
(
param
.
empty
()
)
return
def
;
return
i
;
return
UniSetTypes
::
uni_atoi
(
param
);
}
// -------------------------------------------------------------------------
...
...
tests/tests_unixml.xml
View file @
fa795f3d
...
...
@@ -35,7 +35,7 @@
<LogServer
name=
"smplus"
port=
"3333"
host=
"localhost"
/>
<settings>
<TestData
x=
"10"
y=
"100"
text=
"text"
/>
<TestData
x=
"10"
y=
"100"
text=
"text"
zero=
"0"
negative=
"-10"
/>
<TestNode
name=
"TestNode1"
/>
<TestNode
name=
"TestNode2"
/>
<TestNode
name=
"TestNode3"
/>
...
...
tests/unixml.cc
View file @
fa795f3d
...
...
@@ -103,6 +103,8 @@ TEST_CASE("UniXML", "[UniXML]" )
CHECK
(
it
.
getProp
(
"text"
)
==
"text"
);
CHECK
(
it
.
getIntProp
(
"x"
)
==
10
);
CHECK
(
it
.
getPIntProp
(
"y"
,
-
20
)
==
100
);
CHECK
(
it
.
getPIntProp
(
"zero"
,
20
)
==
0
);
CHECK
(
it
.
getPIntProp
(
"negative"
,
20
)
==
-
10
);
CHECK
(
it
.
getPIntProp
(
"unknown"
,
20
)
==
20
);
}
}
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