Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
3321b43e
Commit
3321b43e
authored
Apr 30, 2012
by
Davis King
Browse files
Added unit tests for new sparse vector routines.
parent
7f434061
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
dlib/test/CMakeLists.txt
dlib/test/CMakeLists.txt
+1
-0
dlib/test/makefile
dlib/test/makefile
+1
-0
dlib/test/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