-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1712 from gonuke/package_tests
add tests for Package
- Loading branch information
Showing
5 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <string> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "package.h" | ||
|
||
using cyclus::Package; | ||
|
||
TEST(PackageTests, Create) { | ||
|
||
std::string exp_name = "foo"; | ||
double exp_min = 0.1; | ||
double exp_max = 0.9; | ||
std::string exp_strat = "first"; | ||
|
||
Package::Ptr p = Package::Create(exp_name, exp_min, exp_max, exp_strat); | ||
|
||
EXPECT_EQ(exp_name, p->name()); | ||
EXPECT_DOUBLE_EQ(exp_min, p->fill_min()); | ||
EXPECT_DOUBLE_EQ(exp_max, p->fill_max()); | ||
EXPECT_EQ(exp_strat, p->strategy()); | ||
|
||
// note: can't test this against a specific package ID because | ||
// that value changes depending on which order all the | ||
// tests are run and whether they are all run | ||
// Therefore: test that it's not the same as the unpackaged ID | ||
EXPECT_NE(Package::unpackaged_id(), p->id()); | ||
|
||
Package::Ptr q = Package::Create(exp_name, exp_min, exp_max, exp_strat); | ||
// note: can't test this against a specific package ID because | ||
// that value changes depending on which order all the | ||
// tests are run and whether they are all run | ||
// Therefore: test that it's not the same as the unpackaged ID | ||
// or as the previous package | ||
EXPECT_NE(Package::unpackaged_id(), q->id()); | ||
EXPECT_NE(q->id(), p->id()); | ||
|
||
} | ||
|
||
TEST(PackageTests, UnpackagedID) { | ||
EXPECT_EQ(1, Package::unpackaged_id()); | ||
} |