Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
3321b43e
Commit
3321b43e
authored
May 01, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit tests for new sparse vector routines.
parent
7f434061
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
CMakeLists.txt
dlib/test/CMakeLists.txt
+1
-0
makefile
dlib/test/makefile
+1
-0
sparse_vector.cpp
dlib/test/sparse_vector.cpp
+67
-0
No files found.
dlib/test/CMakeLists.txt
View file @
3321b43e
...
...
@@ -101,6 +101,7 @@ set (tests
sockets2.cpp
sockets.cpp
sockstreambuf.cpp
sparse_vector.cpp
stack.cpp
static_map.cpp
static_set.cpp
...
...
dlib/test/makefile
View file @
3321b43e
...
...
@@ -116,6 +116,7 @@ SRC += smart_pointers.cpp
SRC
+=
sockets2.cpp
SRC
+=
sockets.cpp
SRC
+=
sockstreambuf.cpp
SRC
+=
sparse_vector.cpp
SRC
+=
stack.cpp
SRC
+=
static_map.cpp
SRC
+=
static_set.cpp
...
...
dlib/test/sparse_vector.cpp
0 → 100644
View file @
3321b43e
// Copyright (C) 2012 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#include "tester.h"
#include <dlib/svm.h>
#include <dlib/rand.h>
#include <dlib/string.h>
#include <vector>
#include <sstream>
#include <ctime>
namespace
{
using
namespace
test
;
using
namespace
dlib
;
using
namespace
std
;
using
namespace
dlib
::
sparse_vector
;
dlib
::
logger
dlog
(
"test.sparse_vector"
);
class
sparse_vector_tester
:
public
tester
{
public
:
sparse_vector_tester
(
)
:
tester
(
"test_sparse_vector"
,
// the command line argument name for this test
"Run tests on the sparse_vector routines."
,
// the command line argument description
0
// the number of command line arguments for this test
)
{
}
void
perform_test
(
)
{
std
::
map
<
unsigned
int
,
double
>
v
;
v
[
4
]
=
8
;
v
[
2
]
=
-
4
;
v
[
9
]
=
10
;
DLIB_TEST
(
max
(
v
)
==
10
);
DLIB_TEST
(
min
(
v
)
==
-
4
);
v
.
clear
();
v
[
4
]
=
8
;
v
[
9
]
=
10
;
DLIB_TEST
(
max
(
v
)
==
10
);
DLIB_TEST
(
min
(
v
)
==
0
);
v
.
clear
();
v
[
4
]
=
-
9
;
v
[
9
]
=
-
4
;
DLIB_TEST
(
max
(
v
)
==
0
);
DLIB_TEST
(
min
(
v
)
==
-
9
);
}
};
sparse_vector_tester
a
;
}
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