Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Niflib
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Grant Kim
Niflib
Commits
2d56b4d8
Commit
2d56b4d8
authored
13 years ago
by
Amorilia
Browse files
Options
Downloads
Patches
Plain Diff
Added test for writing incomplete trees (fails at the moment).
parent
2d89aa38
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+4
-0
4 additions, 0 deletions
CMakeLists.txt
test/CMakeLists.txt
+13
-0
13 additions, 0 deletions
test/CMakeLists.txt
test/write_test.cpp
+37
-0
37 additions, 0 deletions
test/write_test.cpp
with
54 additions
and
0 deletions
CMakeLists.txt
+
4
−
0
View file @
2d56b4d8
...
...
@@ -428,3 +428,7 @@ TriStripper/policy.cpp
set_target_properties
(
niflib
PROPERTIES DEFINE_SYMBOL BUILDING_NIFLIB_DLL
)
# build the tests, this needs boost
enable_testing
()
add_subdirectory
(
test
)
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
0 → 100644
+
13
−
0
View file @
2d56b4d8
# find boost; we use this for the testing framework
if
(
MINGW
)
set
(
Boost_COMPILER -gcc45
)
endif
(
MINGW
)
find_package
(
Boost 1.45.0 REQUIRED COMPONENTS unit_test_framework
)
include_directories
(
${
Boost_INCLUDE_DIRS
}
)
foreach
(
TEST
write_test
)
add_executable
(
${
TEST
}
${
TEST
}
.cpp
)
target_link_libraries
(
${
TEST
}
${
Boost_UNIT_TEST_FRAMEWORK_LIBRARY
}
niflib
)
add_test
(
niflib::
${
TEST
}
${
TEST
}
)
endforeach
()
This diff is collapsed.
Click to expand it.
test/write_test.cpp
0 → 100644
+
37
−
0
View file @
2d56b4d8
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include
<boost/test/unit_test.hpp>
#include
<sstream>
// stringstream
#include
"niflib.h"
#include
"obj/NiNode.h"
#include
"obj/NiKeyframeController.h"
using
namespace
Niflib
;
using
namespace
std
;
BOOST_AUTO_TEST_SUITE
(
write_test_suite
)
BOOST_AUTO_TEST_CASE
(
write_incomplete_tree_test
)
{
stringstream
ss
;
// create a simple nif tree with back reference
NiNodeRef
node
=
new
NiNode
;
NiKeyframeControllerRef
ctrl
=
new
NiKeyframeController
;
node
->
AddController
(
ctrl
);
BOOST_REQUIRE_EQUAL
(
ctrl
->
GetTarget
(),
node
);
// controller target is the node, but isn't in the tree
// check that WriteNifTree does not throw
BOOST_CHECK_NO_THROW
(
WriteNifTree
(
ss
,
ctrl
));
// check that written target is NULL
ss
.
seekg
(
0
);
NiObjectRef
root
;
BOOST_CHECK_NO_THROW
(
root
=
ReadNifTree
(
ss
));
NiKeyframeControllerRef
ctrl2
=
DynamicCast
<
NiKeyframeController
>
(
root
);
BOOST_REQUIRE
(
ctrl2
!=
NULL
);
BOOST_CHECK
(
ctrl2
->
GetTarget
()
==
NULL
);
}
BOOST_AUTO_TEST_SUITE_END
()
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