Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatnai49 committed Apr 18, 2024
1 parent 48d1852 commit ebe65be
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@
"uuid": "2badf89b-efc4-46f1-af8d-b7d2440e61c0",
"practices": [],
"prerequisites": [],
"difficulty": 5
"difficulty": 7
},
{
"slug": "list-ops",
Expand Down
7 changes: 1 addition & 6 deletions exercises/practice/zebra-puzzle/.meta/example.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "zebra_puzzle.h"
#include <algorithm>
#include <iostream>
#include <map>
Expand All @@ -9,12 +10,6 @@ using namespace std;
namespace zebra_puzzle
{

typedef struct
{
string drinksWater;
string ownsZebra;
} Solution;

enum Color { Red, Green, Ivory, Yellow, Blue };
enum Nationality { Englishman, Spaniard, Ukrainian, Norwegian, Japanese };
enum Pet { Dog, Snails, Fox, Horse, Zebra };
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/zebra-puzzle/.meta/example.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
namespace zebra_puzzle
{

typedef struct
struct Solution
{
std::string drinksWater;
std::string ownsZebra;
} Solution;

};
Solution solve();

} // namespace zebra_puzzle
Expand Down
5 changes: 4 additions & 1 deletion exercises/practice/zebra-puzzle/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
# is regenerated, comments can be added via a `comment` key.

[16efb4e4-8ad7-4d5e-ba96-e5537b66fd42]
description = "solve the zebra puzzle and answer who drinks water and who owns zebra"
description = "resident who drinks water"

[084d5b8b-24e2-40e6-b008-c800da8cd257]
description = "resident who owns zebra"

14 changes: 0 additions & 14 deletions exercises/practice/zebra-puzzle/zebra_puzzle.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
#include "zebra_puzzle.h"

#include <string>

using namespace std;

namespace zebra_puzzle
{

typedef struct
{
std::string drinksWater;
std::string ownsZebra;
} Solution;

Solution solve()
{
// IMPLEMENT YOUR LOGIC HERE
}

} // namespace zebra_puzzle
9 changes: 9 additions & 0 deletions exercises/practice/zebra-puzzle/zebra_puzzle.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#if !defined(ZEBRA_PUZZLE_H)
#define ZEBRA_PUZZLE_H

#include <string>

namespace zebra_puzzle
{

struct Solution
{
std::string drinksWater;
std::string ownsZebra;
};


} // namespace zebra_puzzle

Expand Down
7 changes: 6 additions & 1 deletion exercises/practice/zebra-puzzle/zebra_puzzle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ TEST_CASE("drinks_water", "[16efb4e4-8ad7-4d5e-ba96-e5537b66fd42]")
{
REQUIRE(solution.drinksWater == "Norwegian");
}
}

TEST_CASE("owns_zebra", "[084d5b8b-24e2-40e6-b008-c800da8cd257]")
{
zebra_puzzle::Solution solution = zebra_puzzle::solve();

SECTION("Owns zebra")
{
REQUIRE(solution.ownsZebra == "Japanese");
}

}

0 comments on commit ebe65be

Please sign in to comment.