From e16a66dd64cf37954eb3b91d314e296ace4132bf Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Sat, 25 May 2024 13:47:33 +0200 Subject: [PATCH] fix genres conflict (#587) Signed-off-by: Uilian Ries --- src/modules/book/Book.cpp | 2 +- src/modules/book/BookData.cpp | 50 +++++++++++------------ src/modules/book/BookData.h | 2 +- src/modules/movie/Movie.cpp | 2 +- src/modules/movie/MovieData.cpp | 4 +- src/modules/movie/MovieData.h | 2 +- src/modules/music/Music.cpp | 2 +- src/modules/music/data/Genres.h | 2 +- src/modules/videoGame/VideoGame.cpp | 2 +- src/modules/videoGame/data/Genres.h | 3 +- tests/modules/book/BookTest.cpp | 2 +- tests/modules/movie/MovieTest.cpp | 2 +- tests/modules/music/MusicTest.cpp | 2 +- tests/modules/videoGame/VideoGameTest.cpp | 2 +- 14 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/modules/book/Book.cpp b/src/modules/book/Book.cpp index 934a7d62c..d9a22abeb 100644 --- a/src/modules/book/Book.cpp +++ b/src/modules/book/Book.cpp @@ -15,7 +15,7 @@ std::string_view Book::title() std::string_view Book::genre() { - return Helper::arrayElement(genres); + return Helper::arrayElement(bookGenres); } std::string_view Book::author() diff --git a/src/modules/book/BookData.cpp b/src/modules/book/BookData.cpp index 593016aea..7137cd775 100644 --- a/src/modules/book/BookData.cpp +++ b/src/modules/book/BookData.cpp @@ -109,31 +109,31 @@ const std::array bookFormats{ "Kindle", }; -const std::array genres = {"Adventure stories", - "Classics", - "Crime", - "Fairy tales, fables, and folk tales", - "Fantasy", - "Historical fiction", - "Horror", - "Humour and satire", - "Literary fiction", - "Mystery", - "Poetry", - "Plays", - "Romance", - "Science fiction", - "Short stories", - "Thrillers", - "War", - "Women’s fiction", - "Young adult", - "Non-fiction", - "Autobiography and memoir", - "Biography", - "Essays", - "Non-fiction novel", - "Self-help"}; +const std::array bookGenres = {"Adventure stories", + "Classics", + "Crime", + "Fairy tales, fables, and folk tales", + "Fantasy", + "Historical fiction", + "Horror", + "Humour and satire", + "Literary fiction", + "Mystery", + "Poetry", + "Plays", + "Romance", + "Science fiction", + "Short stories", + "Thrillers", + "War", + "Women’s fiction", + "Young adult", + "Non-fiction", + "Autobiography and memoir", + "Biography", + "Essays", + "Non-fiction novel", + "Self-help"}; const std::array publishers = {"Academic Press", "Ace Books", diff --git a/src/modules/book/BookData.h b/src/modules/book/BookData.h index ab5304970..4982ee268 100644 --- a/src/modules/book/BookData.h +++ b/src/modules/book/BookData.h @@ -7,7 +7,7 @@ namespace faker { extern const std::array authors; extern const std::array bookFormats; -extern const std::array genres; +extern const std::array bookGenres; extern const std::array publishers; extern const std::array bookSeries; extern const std::array titles; diff --git a/src/modules/movie/Movie.cpp b/src/modules/movie/Movie.cpp index 9b9d0ce16..a4d72b128 100644 --- a/src/modules/movie/Movie.cpp +++ b/src/modules/movie/Movie.cpp @@ -7,7 +7,7 @@ namespace faker { std::string_view Movie::genre() { - return Helper::arrayElement(genres); + return Helper::arrayElement(movieGenres); } std::string_view Movie::movieTitle() diff --git a/src/modules/movie/MovieData.cpp b/src/modules/movie/MovieData.cpp index beaa3f0ce..f9e59c3cb 100644 --- a/src/modules/movie/MovieData.cpp +++ b/src/modules/movie/MovieData.cpp @@ -910,7 +910,7 @@ const std::array directors = { "Éric Rohmer" }; -const std::array genres = { +const std::array movieGenres = { "Action", "Comedy", "Drama", @@ -1300,4 +1300,4 @@ const std::array tvShows = { "When They See Us" }; -} \ No newline at end of file +} diff --git a/src/modules/movie/MovieData.h b/src/modules/movie/MovieData.h index ce7ddf0ab..954649140 100644 --- a/src/modules/movie/MovieData.h +++ b/src/modules/movie/MovieData.h @@ -10,7 +10,7 @@ namespace faker extern const std::array actors; extern const std::array actresses; extern const std::array directors; -extern const std::array genres; +extern const std::array movieGenres; extern const std::array movies; extern const std::array tvShows; } diff --git a/src/modules/music/Music.cpp b/src/modules/music/Music.cpp index 2fbda9983..015bed976 100644 --- a/src/modules/music/Music.cpp +++ b/src/modules/music/Music.cpp @@ -14,7 +14,7 @@ std::string Music::artist() std::string Music::genre() { - return Helper::arrayElement(genres); + return Helper::arrayElement(musicGenres); } std::string Music::songName() diff --git a/src/modules/music/data/Genres.h b/src/modules/music/data/Genres.h index fe5ea2188..2fb5ce0ca 100644 --- a/src/modules/music/data/Genres.h +++ b/src/modules/music/data/Genres.h @@ -5,7 +5,7 @@ namespace faker { -const std::vector genres = { +const std::vector musicGenres = { "Rock", "Metal", "Pop", "Electronic", "Folk", "World", "Country", "Jazz", "Funk", "Soul", "Hip Hop", "Classical", "Latin", "Reggae", "Stage And Screen", "Blues", "Rap", }; diff --git a/src/modules/videoGame/VideoGame.cpp b/src/modules/videoGame/VideoGame.cpp index 5c7393f24..b40a981b0 100644 --- a/src/modules/videoGame/VideoGame.cpp +++ b/src/modules/videoGame/VideoGame.cpp @@ -15,7 +15,7 @@ std::string VideoGame::gameTitle() std::string VideoGame::genre() { - return Helper::arrayElement(genres); + return Helper::arrayElement(videoGameGenres); } std::string VideoGame::platform() diff --git a/src/modules/videoGame/data/Genres.h b/src/modules/videoGame/data/Genres.h index 555ae1957..1afd9bd47 100644 --- a/src/modules/videoGame/data/Genres.h +++ b/src/modules/videoGame/data/Genres.h @@ -5,7 +5,8 @@ namespace faker { -const std::vector genres = {"Action", +const std::vector videoGameGenres = { + "Action", "Adventure", "Battle royale", "Dating sim", diff --git a/tests/modules/book/BookTest.cpp b/tests/modules/book/BookTest.cpp index 1bfe76649..8e36092bd 100644 --- a/tests/modules/book/BookTest.cpp +++ b/tests/modules/book/BookTest.cpp @@ -26,7 +26,7 @@ TEST_F(BookTest, shouldGenerateGenre) { const auto bookGenre = Book::genre(); - ASSERT_TRUE(std::ranges::any_of(genres, [bookGenre](const std::string_view& genre) { return genre == bookGenre; })); + ASSERT_TRUE(std::ranges::any_of(bookGenres, [bookGenre](const std::string_view& genre) { return genre == bookGenre; })); } TEST_F(BookTest, shouldGenerateAuthor) diff --git a/tests/modules/movie/MovieTest.cpp b/tests/modules/movie/MovieTest.cpp index ea02dcc50..060cd7fc4 100644 --- a/tests/modules/movie/MovieTest.cpp +++ b/tests/modules/movie/MovieTest.cpp @@ -19,7 +19,7 @@ TEST_F(MovieTest, shouldGenerateGenre) const auto generatedGenre = Movie::genre(); ASSERT_TRUE( - std::ranges::any_of(genres, [generatedGenre](const std::string_view& genre) { return generatedGenre == genre; })); + std::ranges::any_of(movieGenres, [generatedGenre](const std::string_view& genre) { return generatedGenre == genre; })); } TEST_F(MovieTest, shouldGenerateMovieTitle) diff --git a/tests/modules/music/MusicTest.cpp b/tests/modules/music/MusicTest.cpp index 5002d39b7..82740bc6b 100644 --- a/tests/modules/music/MusicTest.cpp +++ b/tests/modules/music/MusicTest.cpp @@ -29,7 +29,7 @@ TEST_F(MusicTest, shouldGenerateGenre) const auto generatedGenre = Music::genre(); ASSERT_TRUE( - std::ranges::any_of(genres, [generatedGenre](const std::string& genre) { return generatedGenre == genre; })); + std::ranges::any_of(musicGenres, [generatedGenre](const std::string& genre) { return generatedGenre == genre; })); } TEST_F(MusicTest, shouldGenerateSongName) diff --git a/tests/modules/videoGame/VideoGameTest.cpp b/tests/modules/videoGame/VideoGameTest.cpp index 59fb9ac76..ab8a63ede 100644 --- a/tests/modules/videoGame/VideoGameTest.cpp +++ b/tests/modules/videoGame/VideoGameTest.cpp @@ -30,7 +30,7 @@ TEST_F(VideoGameTest, shouldGenerateGenre) const auto generatedGenre = VideoGame::genre(); ASSERT_TRUE( - std::ranges::any_of(genres, [generatedGenre](const std::string& genre) { return generatedGenre == genre; })); + std::ranges::any_of(videoGameGenres, [generatedGenre](const std::string& genre) { return generatedGenre == genre; })); } TEST_F(VideoGameTest, shouldGeneratePlatform)