Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stunserver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Stunserver
Commits
72053737
Commit
72053737
authored
Nov 05, 2018
by
john selbie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit test for crc32. Adjusted config parser.
parent
4c8f7c9d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
18 deletions
+90
-18
server/main.cpp
server/main.cpp
+1
-1
testcode/Makefile
testcode/Makefile
+1
-1
testcode/testcode.cpp
testcode/testcode.cpp
+18
-16
testcode/testcrc32.cpp
testcode/testcrc32.cpp
+45
-0
testcode/testcrc32.h
testcode/testcrc32.h
+25
-0
No files found.
server/main.cpp
View file @
72053737
...
@@ -528,8 +528,8 @@ HRESULT BuildServerConfigurationFromArgs(StartupArgs& argsIn, CStunServerConfig*
...
@@ -528,8 +528,8 @@ HRESULT BuildServerConfigurationFromArgs(StartupArgs& argsIn, CStunServerConfig*
Logging
::
LogMsg
(
LL_ALWAYS
,
"Error with --threading. required argument must be between 0 - 64"
);
Logging
::
LogMsg
(
LL_ALWAYS
,
"Error with --threading. required argument must be between 0 - 64"
);
Chk
(
hr
);
Chk
(
hr
);
}
}
config
.
nThreadsPerSocket
=
threadcount
;
}
}
config
.
nThreadsPerSocket
=
threadcount
;
*
pConfigOut
=
config
;
*
pConfigOut
=
config
;
hr
=
S_OK
;
hr
=
S_OK
;
...
...
testcode/Makefile
View file @
72053737
include
../common.inc
include
../common.inc
PROJECT_TARGET
:=
stuntestcode
PROJECT_TARGET
:=
stuntestcode
PROJECT_OBJS
:=
testatomichelpers.o testbuilder.o testclientlogic.o testcmdline.o testcode.o testdatastream.o testfasthash.o testintegrity.o testmessagehandler.o testpolling.o testratelimiter.o testreader.o testrecvfromex.o
PROJECT_OBJS
:=
testatomichelpers.o testbuilder.o testclientlogic.o testcmdline.o testc
rc32.o testc
ode.o testdatastream.o testfasthash.o testintegrity.o testmessagehandler.o testpolling.o testratelimiter.o testreader.o testrecvfromex.o
INCLUDES
:=
$(BOOST_INCLUDE)
$(OPENSSL_INCLUDE)
-I
../common
-I
../stuncore
-I
../networkutils
INCLUDES
:=
$(BOOST_INCLUDE)
$(OPENSSL_INCLUDE)
-I
../common
-I
../stuncore
-I
../networkutils
LIB_PATH
:=
-L
../networkutils
-L
../stuncore
-L
../common
LIB_PATH
:=
-L
../networkutils
-L
../stuncore
-L
../common
...
...
testcode/testcode.cpp
View file @
72053737
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "testclientlogic.h"
#include "testclientlogic.h"
#include "testrecvfromex.h"
#include "testrecvfromex.h"
#include "testfasthash.h"
#include "testfasthash.h"
#include "testcrc32.h"
#include "cmdlineparser.h"
#include "cmdlineparser.h"
#include "oshelper.h"
#include "oshelper.h"
#include "prettyprint.h"
#include "prettyprint.h"
...
@@ -71,7 +72,7 @@ void ReaderFuzzTest()
...
@@ -71,7 +72,7 @@ void ReaderFuzzTest()
void
RunUnitTests
()
void
RunUnitTests
()
{
{
std
::
vector
<
IUnitTest
*
>
vecTests
;
std
::
vector
<
std
::
shared_ptr
<
IUnitTest
>
>
vecTests
;
std
::
shared_ptr
<
CTestDataStream
>
spTestDataStream
(
new
CTestDataStream
);
std
::
shared_ptr
<
CTestDataStream
>
spTestDataStream
(
new
CTestDataStream
);
std
::
shared_ptr
<
CTestReader
>
spTestReader
(
new
CTestReader
);
std
::
shared_ptr
<
CTestReader
>
spTestReader
(
new
CTestReader
);
...
@@ -86,21 +87,22 @@ void RunUnitTests()
...
@@ -86,21 +87,22 @@ void RunUnitTests()
std
::
shared_ptr
<
CTestPolling
>
spTestPolling
(
new
CTestPolling
);
std
::
shared_ptr
<
CTestPolling
>
spTestPolling
(
new
CTestPolling
);
std
::
shared_ptr
<
CTestAtomicHelpers
>
spTestAtomicHelpers
(
new
CTestAtomicHelpers
);
std
::
shared_ptr
<
CTestAtomicHelpers
>
spTestAtomicHelpers
(
new
CTestAtomicHelpers
);
std
::
shared_ptr
<
CTestRateLimiter
>
spTestRateLimiter
(
new
CTestRateLimiter
);
std
::
shared_ptr
<
CTestRateLimiter
>
spTestRateLimiter
(
new
CTestRateLimiter
);
std
::
shared_ptr
<
CTestCRC32
>
spTestCRC32
(
new
CTestCRC32
);
vecTests
.
push_back
(
spTestDataStream
.
get
());
vecTests
.
push_back
(
spTestReader
.
get
());
vecTests
.
push_back
(
spTestDataStream
);
vecTests
.
push_back
(
spTestBuilder
.
get
());
vecTests
.
push_back
(
spTestReader
);
vecTests
.
push_back
(
spTestIntegrity
.
get
());
vecTests
.
push_back
(
spTestBuilder
);
vecTests
.
push_back
(
spTestMessageHandler
.
get
());
vecTests
.
push_back
(
spTestIntegrity
);
vecTests
.
push_back
(
spTestCmdLineParser
.
get
());
vecTests
.
push_back
(
spTestMessageHandler
);
vecTests
.
push_back
(
spTestClientLogic
.
get
());
vecTests
.
push_back
(
spTestCmdLineParser
);
vecTests
.
push_back
(
spTestRecvFromEx4
.
get
());
vecTests
.
push_back
(
spTestClientLogic
);
vecTests
.
push_back
(
spTestRecvFromEx6
.
get
());
vecTests
.
push_back
(
spTestRecvFromEx4
);
vecTests
.
push_back
(
spTestFastHash
.
get
());
vecTests
.
push_back
(
spTestRecvFromEx6
);
vecTests
.
push_back
(
spTestPolling
.
get
());
vecTests
.
push_back
(
spTestFastHash
);
vecTests
.
push_back
(
spTestAtomicHelpers
.
get
());
vecTests
.
push_back
(
spTestPolling
);
vecTests
.
push_back
(
spTestRateLimiter
.
get
());
vecTests
.
push_back
(
spTestAtomicHelpers
);
vecTests
.
push_back
(
spTestRateLimiter
);
vecTests
.
push_back
(
spTestCRC32
);
for
(
size_t
index
=
0
;
index
<
vecTests
.
size
();
index
++
)
for
(
size_t
index
=
0
;
index
<
vecTests
.
size
();
index
++
)
{
{
...
...
testcode/testcrc32.cpp
0 → 100644
View file @
72053737
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: testcrc32.cpp
* Author: jselbie
*
* Created on November 5, 2018, 12:07 AM
*/
#include "commonincludes.hpp"
#include "crc32.h"
#include "unittest.h"
#include "testcrc32.h"
struct
crc_test
{
const
char
*
psz
;
uint32_t
expected
;
};
static
crc_test
g_tests
[]
=
{
{
""
,
0
},
{
"The quick brown fox jumped over the lazy dog."
,
0x82a34642
}
};
HRESULT
CTestCRC32
::
Run
()
{
size_t
numTests
=
ARRAYSIZE
(
g_tests
);
HRESULT
hr
=
S_OK
;
for
(
size_t
i
=
0
;
i
<
numTests
;
i
++
)
{
uint32_t
val
=
crc32
(
0
,
(
uint8_t
*
)(
g_tests
[
i
].
psz
),
strlen
(
g_tests
[
i
].
psz
));
ChkIf
(
val
!=
g_tests
[
i
].
expected
,
E_FAIL
);
}
Cleanup:
return
hr
;
}
testcode/testcrc32.h
0 → 100644
View file @
72053737
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: testcrc32.h
* Author: jselbie
*
* Created on November 5, 2018, 12:07 AM
*/
#ifndef TESTCRC32_H
#define TESTCRC32_H
class
CTestCRC32
:
public
IUnitTest
{
public:
HRESULT
Run
();
UT_DECLARE_TEST_NAME
(
"CTestCRC32"
);
};
#endif
/* TESTCRC32_H */
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