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
ca63ea7f
Commit
ca63ea7f
authored
May 15, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(VTypes): исправлена ошибка в wsize для типов Signed и Unsigned
parent
3a902769
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
+28
-13
UDPPacket.h
extensions/UNetUDP/UDPPacket.h
+1
-1
VTypes.h
extensions/include/VTypes.h
+2
-2
test_vtypes.cc
extensions/tests/test_vtypes.cc
+25
-10
No files found.
extensions/UNetUDP/UDPPacket.h
View file @
ca63ea7f
...
...
@@ -35,7 +35,7 @@ namespace UniSetUDP
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
UDPHeader
*
p
);
}
__attribute__
((
packed
));
static
unsigned
long
MaxPacketNum
=
std
::
numeric_limits
<
unsigned
long
>::
max
();
const
unsigned
long
MaxPacketNum
=
std
::
numeric_limits
<
unsigned
long
>::
max
();
struct
UDPAData
{
...
...
extensions/include/VTypes.h
View file @
ca63ea7f
...
...
@@ -259,7 +259,7 @@ namespace VTypes
/*! размер в словах */
static
int
wsize
()
{
return
sizeof
(
unsigned
short
)
;
return
1
;
}
/*! тип значения */
static
VType
type
()
...
...
@@ -298,7 +298,7 @@ namespace VTypes
/*! размер в словах */
static
int
wsize
()
{
return
sizeof
(
signed
short
)
;
return
1
;
}
/*! тип значения */
static
VType
type
()
...
...
extensions/tests/test_vtypes.cc
View file @
ca63ea7f
...
...
@@ -2,11 +2,25 @@
#include <limits>
#include "VTypes.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
VTypes
;
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: wsize test"
,
"[vtypes][wsize]"
)
{
REQUIRE
(
F2
::
wsize
()
==
2
);
REQUIRE
(
F2r
::
wsize
()
==
2
);
REQUIRE
(
F4
::
wsize
()
==
4
);
REQUIRE
(
Byte
::
wsize
()
==
1
);
REQUIRE
(
Unsigned
::
wsize
()
==
1
);
REQUIRE
(
Signed
::
wsize
()
==
1
);
REQUIRE
(
I2
::
wsize
()
==
2
);
REQUIRE
(
I2r
::
wsize
()
==
2
);
REQUIRE
(
U2
::
wsize
()
==
2
);
REQUIRE
(
U2r
::
wsize
()
==
2
);
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: I2"
,
"[vtypes][I2]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -33,7 +47,7 @@ TEST_CASE("VTypes: I2", "[vtypes][I2]")
REQUIRE
(
(
int
)
v2
==
-
65536
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: I2r"
,
"[vtypes][I2r]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -68,7 +82,7 @@ TEST_CASE("VTypes: I2r", "[vtypes][I2r]")
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: U2"
,
"[vtypes][U2]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -101,7 +115,7 @@ TEST_CASE("VTypes: U2", "[vtypes][U2]")
REQUIRE
(
(
unsigned
int
)
v2
==
0xffff0000
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: U2r"
,
"[vtypes][U2r]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -155,7 +169,7 @@ TEST_CASE("VTypes: F2", "[vtypes][F2]")
REQUIRE
(
(
float
)
v2
==
f
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: F2r"
,
"[vtypes][F2r]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -187,7 +201,7 @@ TEST_CASE("VTypes: F2r", "[vtypes][F2r]")
REQUIRE
(
(
float
)
v2
==
f
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: F4"
,
"[vtypes][F4]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -233,7 +247,7 @@ TEST_CASE("VTypes: F4", "[vtypes][F4]")
}
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: Byte"
,
"[vtypes][byte]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -260,7 +274,7 @@ TEST_CASE("VTypes: Byte", "[vtypes][byte]")
REQUIRE
(
(
unsigned
char
)
v
[
0
]
==
255
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: Unsigned"
,
"[vtypes][unsigned]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -281,7 +295,7 @@ TEST_CASE("VTypes: Unsigned", "[vtypes][unsigned]")
REQUIRE
(
(
unsigned
short
)
v
==
65535
);
}
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"VTypes: Signed"
,
"[vtypes][signed]"
)
{
SECTION
(
"Default constructor"
)
...
...
@@ -302,3 +316,4 @@ TEST_CASE("VTypes: Signed", "[vtypes][signed]")
REQUIRE
(
(
signed
short
)
v
==
(
signed
short
)
d
);
}
}
// -----------------------------------------------------------------------------
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