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
2c762814
Commit
2c762814
authored
6 years ago
by
Edward Brown
Browse files
Options
Downloads
Patches
Plain Diff
Added unit tests for RowLocation operators.
Re #22263
parent
7008b170
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
qt/widgets/common/CMakeLists.txt
+1
-0
1 addition, 0 deletions
qt/widgets/common/CMakeLists.txt
qt/widgets/common/test/Batch/RowLocationTest.h
+72
-0
72 additions, 0 deletions
qt/widgets/common/test/Batch/RowLocationTest.h
with
73 additions
and
0 deletions
qt/widgets/common/CMakeLists.txt
+
1
−
0
View file @
2c762814
...
@@ -540,6 +540,7 @@ set( TEST_FILES
...
@@ -540,6 +540,7 @@ set( TEST_FILES
test/DataProcessorUI/GenericDataProcessorPresenterTest.h
test/DataProcessorUI/GenericDataProcessorPresenterTest.h
test/Batch/QtAdaptedModelTest.h
test/Batch/QtAdaptedModelTest.h
test/Batch/RowLocationTest.h
test/ParseKeyValueStringTest.h
test/ParseKeyValueStringTest.h
test/DataProcessorUI/QOneLevelTreeModelTest.h
test/DataProcessorUI/QOneLevelTreeModelTest.h
...
...
This diff is collapsed.
Click to expand it.
qt/widgets/common/test/Batch/RowLocationTest.h
0 → 100644
+
72
−
0
View file @
2c762814
#ifndef MANTID_MANTIDWIDGETS_ROWLOCATIONTEST_H
#define MANTID_MANTIDWIDGETS_ROWLOCATIONTEST_H
#include
<cxxtest/TestSuite.h>
#include
<gtest/gtest.h>
#include
<vector>
#include
<algorithm>
#include
"MantidQtWidgets/Common/Batch/RowLocation.h"
using
namespace
MantidQt
::
MantidWidgets
;
using
namespace
MantidQt
::
MantidWidgets
::
Batch
;
using
namespace
testing
;
class
RowLocationTest
:
public
CxxTest
::
TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static
RowLocationTest
*
createSuite
()
{
return
new
RowLocationTest
();
}
static
void
destroySuite
(
RowLocationTest
*
suite
)
{
delete
suite
;
}
void
testEqualityIsBasedOnPaths
()
{
TS_ASSERT
(
RowLocation
({
0
,
1
,
2
})
==
RowLocation
({
0
,
1
,
2
}));
TS_ASSERT
(
RowLocation
({})
==
RowLocation
({}));
TS_ASSERT
(
!
(
RowLocation
({})
==
RowLocation
({
1
})));
TS_ASSERT
(
!
(
RowLocation
({
1
,
2
})
==
RowLocation
({
1
})));
TS_ASSERT
(
RowLocation
({
0
,
0
,
2
})
!=
RowLocation
({
0
,
1
,
2
}));
TS_ASSERT
(
RowLocation
({
0
,
2
,
2
})
!=
RowLocation
({
0
,
1
,
2
}));
TS_ASSERT
(
!
(
RowLocation
({
0
,
2
,
2
})
!=
RowLocation
({
0
,
2
,
2
})));
}
void
testOrderingIsLexographicalBasedOnPath
()
{
TS_ASSERT
(
RowLocation
({})
<
RowLocation
({
0
}));
TS_ASSERT
(
RowLocation
({
0
})
<
RowLocation
({
1
}));
TS_ASSERT
(
RowLocation
({
0
})
<
RowLocation
({
0
,
1
}));
TS_ASSERT
(
RowLocation
({
0
,
1
})
<
RowLocation
({
1
,
0
}));
TS_ASSERT
(
RowLocation
({
0
,
1
})
<
RowLocation
({
1
}));
TS_ASSERT
(
RowLocation
({
0
,
1
})
<
RowLocation
({
0
,
1
,
1
}));
}
void
testOrderingIsLexographicalBasedOnPathSort
()
{
// clang-format off
auto
items
=
std
::
vector
<
RowLocation
>
({
RowLocation
({}),
RowLocation
({
1
,
0
}),
RowLocation
({
1
,
0
,
2
}),
RowLocation
({
2
,
0
}),
RowLocation
({
1
,
2
,
1
}),
RowLocation
({
2
,
2
}),
RowLocation
({
1
,
2
}),
RowLocation
({
1
,
2
,
0
})
});
auto
expected
=
std
::
vector
<
RowLocation
>
({
RowLocation
({}),
RowLocation
({
1
,
0
}),
RowLocation
({
1
,
0
,
2
}),
RowLocation
({
1
,
2
}),
RowLocation
({
1
,
2
,
0
}),
RowLocation
({
1
,
2
,
1
}),
RowLocation
({
2
,
0
}),
RowLocation
({
2
,
2
})
});
// clang-format on
std
::
sort
(
items
.
begin
(),
items
.
end
());
TS_ASSERT_EQUALS
(
expected
,
items
);
}
};
#endif // MANTID_MANTIDWIDGETS_ROWLOCATIONTEST_H
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