Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
mantidproject
mantid
Commits
ca73d847
Commit
ca73d847
authored
6 years ago
by
Sam Jenkins
Browse files
Options
Downloads
Patches
Plain Diff
Re #23574 updated unit tests
parent
7d9b8963
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/DataHandling/test/LoadBinStlTest.h
+11
-5
11 additions, 5 deletions
Framework/DataHandling/test/LoadBinStlTest.h
Testing/Data/UnitTest/cylinderBin.stl.md5
+1
-0
1 addition, 0 deletions
Testing/Data/UnitTest/cylinderBin.stl.md5
with
12 additions
and
5 deletions
Framework/DataHandling/test/LoadBinStlTest.h
+
11
−
5
View file @
ca73d847
#ifndef LOAD_BINSTL_TEST_H_
#define LOAD_BINSTL_TEST_H_
#include
"MantidAPI/AnalysisDataService.h"
#include
"MantidAPI/FrameworkManager.h"
#include
"MantidAPI/Sample.h"
...
...
@@ -39,8 +42,8 @@ void test_cube() {
TS_ASSERT_EQUALS
(
cube
->
numberOfTriangles
(),
12
);
TS_ASSERT_DELTA
(
cube
->
volume
(),
3000
,
0.001
);
}
//test removed because currently no cylinderBin.stl
void
x
test_cylinder
()
{
void
test_cylinder
()
{
std
::
string
path
=
FileFinder
::
Instance
().
getFullPath
(
"cylinderBin.stl"
);
std
::
unique_ptr
<
LoadBinStl
>
Loader
=
std
::
make_unique
<
LoadBinStl
>
(
path
);
auto
cylinder
=
Loader
->
readStl
();
...
...
@@ -59,16 +62,19 @@ void test_cube() {
TS_ASSERT_EQUALS
(
tube
->
numberOfTriangles
(),
2160
);
TS_ASSERT_DELTA
(
tube
->
volume
(),
7068
,
1
);
}
//check that isBinaryStl returns false if the file contains an incomplete vertex
void
test_fail_invalid_vertex
()
{
std
::
string
path
=
FileFinder
::
Instance
().
getFullPath
(
"invalid_vertexBin.stl"
);
std
::
unique_ptr
<
LoadBinStl
>
Loader
=
std
::
make_unique
<
LoadBinStl
>
(
path
);
TS_ASSERT
(
!
(
Loader
->
isBinarySTL
()));
}
//check that isBinaryStl returns false if the file contains an incomplete triangle
void
test_fail_invalid_triangle
()
{
std
::
string
path
=
FileFinder
::
Instance
().
getFullPath
(
"invalid_triangleBin.stl"
);
std
::
unique_ptr
<
LoadBinStl
>
Loader
=
std
::
make_unique
<
LoadBinStl
>
(
path
);
TS_ASSERT
(
!
(
Loader
->
isBinarySTL
()));
}
};
\ No newline at end of file
};
//add tests for isBinaryStl e.g. attempting to load an ascii .stl
#endif
/* LOAD_BINSTL_TEST_H_ */
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Testing/Data/UnitTest/cylinderBin.stl.md5
0 → 100644
+
1
−
0
View file @
ca73d847
8371032c426dd1dc102156c9d8987dd9
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