Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph-python
Commits
9b39ddf9
Commit
9b39ddf9
authored
11 years ago
by
Francois Keith
Browse files
Options
Downloads
Patches
Plain Diff
Add a unittest for the interpreter.
parent
74a13936
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
unitTesting/CMakeLists.txt
+20
-9
20 additions, 9 deletions
unitTesting/CMakeLists.txt
unitTesting/interpreter-test.cc
+33
-0
33 additions, 0 deletions
unitTesting/interpreter-test.cc
with
54 additions
and
9 deletions
CMakeLists.txt
+
1
−
0
View file @
9b39ddf9
...
@@ -53,6 +53,7 @@ ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=2)
...
@@ -53,6 +53,7 @@ ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=2)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
include
)
ADD_SUBDIRECTORY
(
include
)
ADD_SUBDIRECTORY
(
doc
)
ADD_SUBDIRECTORY
(
doc
)
ADD_SUBDIRECTORY
(
unitTesting
)
SETUP_PROJECT_FINALIZE
()
SETUP_PROJECT_FINALIZE
()
This diff is collapsed.
Click to expand it.
unitTesting/CMakeLists.txt
+
20
−
9
View file @
9b39ddf9
...
@@ -2,23 +2,34 @@
...
@@ -2,23 +2,34 @@
# Copyright
# Copyright
#
#
SET
(
EXECUTABLE_NAME test
${
PROJECT_NAME
}
)
INCLUDE
(
CTest
)
set
(
Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0
)
INCLUDE
(
../cmake/python.cmake
)
FINDPYTHON
()
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_PATH
}
)
INCLUDE_DIRECTORIES
(
${
Boost_INCLUDE_DIRS
}
)
LINK_DIRECTORIES
(
${
Boost_LIBRARY_DIRS
}
${
PYTHON_LIBRARY_DIRS
}
)
ADD_DEFINITIONS
(
-DDEBUG=2
)
ADD_DEFINITIONS
(
-DDEBUG=2
)
# provide path to library libdynamic-graph.so
# provide path to library libdynamic-graph.so
LINK_DIRECTORIES
(
${
DYNAMIC_GRAPH_LIBRARY_DIRS
}
)
LINK_DIRECTORIES
(
${
DYNAMIC_GRAPH_LIBRARY_DIRS
}
)
ADD_EXECUTABLE
(
${
EXECUTABLE_NAME
}
main.cc
dynamic-graph-python-test.cc
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/include
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/include
)
LINK_DIRECTORIES
(
${${
PROJECT_NAME
}
_BINARY_DIR
}
/src
)
LINK_DIRECTORIES
(
${${
PROJECT_NAME
}
_BINARY_DIR
}
/src
)
TARGET_LINK_LIBRARIES
(
${
EXECUTABLE_NAME
}
dynamic-graph-python
)
# Add dynamic-graph compilation flags and link to library libdynamic-graph.so
# Add dynamic-graph compilation flags and link to library libdynamic-graph.so
ADD_DEFINITIONS
(
${
DYNAMIC_GRAPH_CFLAGS
}
)
ADD_DEFINITIONS
(
${
DYNAMIC_GRAPH_CFLAGS
}
)
TARGET_LINK_LIBRARIES
(
${
EXECUTABLE_NAME
}
${
DYNAMIC_GRAPH_LIBRARIES
}
)
SET
(
EXECUTABLE_NAME interpreter-test
)
ADD_EXECUTABLE
(
${
EXECUTABLE_NAME
}
interpreter-test.cc
)
TARGET_LINK_LIBRARIES
(
${
EXECUTABLE_NAME
}
dynamic-graph-python
)
TARGET_LINK_LIBRARIES
(
${
EXECUTABLE_NAME
}
${
DYNAMIC_GRAPH_LIBRARIES
}
-lpthread -ldl -lutil
)
ADD_TEST
(
${
EXECUTABLE_NAME
}
${
EXECUTABLE_NAME
}
)
This diff is collapsed.
Click to expand it.
unitTesting/interpreter-test.cc
0 → 100644
+
33
−
0
View file @
9b39ddf9
// The purpose of this unit test is to evaluate the memory consumption
// when call the interpreter.
#include
"dynamic-graph/python/interpreter.hh"
int
main
(
int
argc
,
char
**
argv
)
{
int
numTest
=
1
;
if
(
argc
>
1
)
numTest
=
atoi
(
argv
[
1
]);
dynamicgraph
::
python
::
Interpreter
interp
;
std
::
string
command
;
for
(
int
i
=
0
;
i
<
numTest
;
++
i
)
{
//correct input
command
=
"print
\"
Hello world
\"
"
;
interp
.
python
(
command
);
//incorrect input
command
=
"print Hello"
;
interp
.
python
(
command
);
std
::
string
result
;
std
::
string
out
;
std
::
string
err
;
//correct input
interp
.
python
(
"print
\"
I am the interpreter
\"
"
,
result
,
out
,
err
);
//incorrect input
interp
.
python
(
"print I am the interpreter"
,
result
,
out
,
err
);
}
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment