Skip to content

Commit

Permalink
Moved keyname_utils tests from REQUIRE to CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
mercere99 committed Nov 30, 2023
1 parent b76c2cd commit 2329f2e
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/tools/keyname_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @note This file is part of Empirical, https://github.com/devosoft/Empirical
* @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
* @date 2021
* @date 2021-2023
*
* @file keyname_utils.cpp
*/
Expand Down Expand Up @@ -30,69 +30,69 @@ TEST_CASE("Test keyname_utils", "[tools]")

name = "seed=100+foobar=20+_hash=asdf+ext=.txt";
goal["_"] = name;
REQUIRE( emp::keyname::unpack(name) == goal );
CHECK( emp::keyname::unpack(name) == goal );


// reorderings
name = "foobar=20+seed=100+_hash=asdf+ext=.txt";
goal["_"] = name;
REQUIRE( emp::keyname::unpack(name) == goal );
CHECK( emp::keyname::unpack(name) == goal );


name = "_hash=asdf+foobar=20+seed=100+ext=.txt";
goal["_"] = name;
REQUIRE( emp::keyname::unpack(name) == goal );
CHECK( emp::keyname::unpack(name) == goal );


// should ignore path
name = "path/seed=100+foobar=20+_hash=asdf+ext=.txt";
goal["_"] = name;
REQUIRE( emp::keyname::unpack(name) == goal );
CHECK( emp::keyname::unpack(name) == goal );


name = "~/more=path/+blah/seed=100+foobar=20+_hash=asdf+ext=.txt";
goal["_"] = name;
REQUIRE( emp::keyname::unpack(name) == goal );
CHECK( emp::keyname::unpack(name) == goal );


name = "just/a/regular/file.pdf";
REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
CHECK( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
{"file.pdf", ""},
{"_", "just/a/regular/file.pdf"}
}));

name = "key/with/no+=value/file+ext=.pdf";
REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
CHECK( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
{"file", ""},
{"ext", ".pdf"},
{"_", "key/with/no+=value/file+ext=.pdf"}
}));

name = "multiple/=s/file=biz=blah+ext=.pdf";
REQUIRE( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
CHECK( emp::keyname::unpack(name) == (emp::keyname::unpack_t{
{"file", "biz=blah"},
{"ext", ".pdf"},
{"_", "multiple/=s/file=biz=blah+ext=.pdf"}
}));

// test pack reorderings
REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "20"},
{"_hash", "asdf"},
{"ext", ".txt"}
})) == "foobar=20+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"_hash", "asdf"},
{"seed", "100"},
{"foobar", "20"},
{"ext", ".txt"}
})) == "foobar=20+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"_hash", "asdf"},
{"foobar", "20"},
{"ext", ".txt"},
Expand All @@ -101,23 +101,23 @@ TEST_CASE("Test keyname_utils", "[tools]")
);

// different values
REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "blip"},
{"_hash", "asdf"},
{"ext", ".txt"}
})) == "foobar=blip+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "a100"},
{"foobar", "blip"},
{"_hash", "asdf"},
{"ext", ".txt"}
})) == "foobar=blip+seed=a100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"aseed", "a100"},
{"foobar", "blip"},
{"_hash", "asdf"},
Expand All @@ -126,7 +126,7 @@ TEST_CASE("Test keyname_utils", "[tools]")
);

// should ignore "_" key
REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "20"},
{"_hash", "asdf"},
Expand All @@ -135,7 +135,7 @@ TEST_CASE("Test keyname_utils", "[tools]")
})) == "foobar=20+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "20"},
{"_hash", "asdf"},
Expand All @@ -144,7 +144,7 @@ TEST_CASE("Test keyname_utils", "[tools]")
})) == "foobar=20+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "20"},
{"_hash", "asdf"},
Expand All @@ -153,7 +153,7 @@ TEST_CASE("Test keyname_utils", "[tools]")
})) == "foobar=20+seed=100+_hash=asdf+ext=.txt"
);

REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"seed", "100"},
{"foobar", "20"},
{"_hash", "asdf"},
Expand All @@ -163,7 +163,7 @@ TEST_CASE("Test keyname_utils", "[tools]")
);

// missing extension
REQUIRE( (emp::keyname::pack({
CHECK( (emp::keyname::pack({
{"_hash", "asdf"},
{"foobar", "20"},
{"seed", "100"}
Expand Down

0 comments on commit 2329f2e

Please sign in to comment.