Cater Waiter - Test cases

Hey there!

Developing isn’t easy as I don’t know the test cases.
I just found the ones for python, which makes it a bit clearer
but I have to figure out how this fits to Julia.

Do you really think, this is an ‘easy’ exercise?
Maybe, if I’d have test cases.
Can you please supply them here?

thanks in advance

with kind regards,

Nisang

I found, that for alcohol the following is tested:

[“almond liqueur”,“amaretto”,“beer”,“bourbon”,“bloody mary”,“champagne”,“coffee liqueur”,“french 75”,“ginger beer”,“gin”,“gin fizz”," manhattan","margarita ",“martini”,“orange curacao”, “rum”,“old fashioned”,“scotch”,“stalksclub”,“sweet vermouth”,“tequila”,“triple sec”,“vodka”,“whiskey”,“pitu”,“liqueur”])

but e.g. for
“french 75”, “martini”,“old fashioned” no match (setdiff(drink_ingredients,s1)) is found
for "margarita " only with one extra space
Can you please help with the correct test cases file
??

Task 2?

Implement the check_drinks(<drink_name>, <drink_ingredients>) function that takes the name of a drink and a vector of ingredients. The function should return the name of the drink followed by “Mocktail” if the drink has no alcoholic ingredients, and drink name followed by “Cocktail” if the drink includes alcohol. For the purposes of this exercise, cocktails will only include alcohols from the ALCOHOLS constant

You’re given a vector of strings. You should be testing for string equality. Spaces are not treated differently than any other characters here.

Concept exercises by design don’t show the tests in the online editor. If you’re in an environment where you can work locally, the tests file is included when you download the exercise files. Otherwise, if you want to, you can check the track’s GitHub repository since all exercise files are stored there as well.

Hi @AnandNisang :wave:

Lets be clear: I am no Julia expert, but I am the author of the Cater-Waiter exercise for Python which was ported over to Julia.

To solve this task in Python, you wouldn’t use a set difference, you would be checking if the sets in question were disjoint.

Difference isn’t giving you the correct information. I am pretty sure that the process in Julia is the same. Here are some docs on set-like collections in Julia. In particular, I think you might be looking for something like isdisjoint().

Hope that helps.

Yup. And I wasn’t kind in this exercise. The test data here is loooong and complicated because I wanted to discourage rummaging through it manually. The only reasonable solution is to use sets so that their properties are really emphasized.

A tad crummy, but I was also really explicit and careful with the instructions and explanations. At least I think I was. :grimacing:

2 Likes

Hi Bethany,

thanks for being clear!

yes, I’m using isdisjoint(), not for the solution but
to check which alcoholic drinks ALCOHOLS should contain.
I used setdiff(drink_ingredients,s1) not in order to solve the exercise but to get displayed which drinks are in drink_ingredients, which were not in my ALCOHOLS constant already!

Or maybe I got it wrong that I have to build the ALCOHOLS constant…
while it is already in the test environment??
I will check that soon!
YES that’s it, …
after I commented my own ALCOHOLS constant… my code passed all the neccessary checks correctly!!

Sometimes it helps just to ask others and get information of there knowledge and point of view…
and then I can see, too!

thanks for that a lot!

My Question: Are the CONSTANTS VEGAN, KETO… also included??

my suggestion:
would be fine to add this to the exercises description:
For the purposes of this exercise, cocktails will only include alcohols from the ALCOHOLS constant (which is part of the test environment already)

Hi Andras,

thanks for your answer.

what I found is, that this is true in most of the cases
but there are execptions, e.g. “Bob the lackadaisical teenager”

Exception to what? Bob is a practice exercise, and Cater Waiter is a concept exercise. If you’re not seeing a tests tab for Bob in the editor, that’s odd.

Well I was at Github today:
“python/exercises/concept/cater-waiter/sets_test_data.py at main · exercism/python · GitHub”
and found Julia Cater Waiter test cases… for Python
Do they have the same data?
I had to convert them to fit into Julia " instead of ’ [ instead of {

Yes, that’s what I’m doing:

I’m isdisjoint in check_drinks
and issubset() in categorize_dish
I have to rethink, how to use issubset() in order to find out, which ingrediant to check, so that it’s clear, it cannot be e.g. vegan (because it contains milk) and so on.
But, it’s late in the evening so I will do it tomorrow!

You’re right!
that’s a difference I was not aware of indeed while answering

They might, but that’s beside the point really. Are you doing Caiter Waiter on Python or Julia? If you’re going to look at tests, it’d make sense to look at the ones for the exercise you’re doing on the track you’re doing. Just because an exercise is borrowed from another track that doesn’t mean their test suites are interchangeable.

2 Likes

Why aren’t you looking at julia/exercises/concept/cater-waiter/sets_categories_data.jl at main · exercism/julia · GitHub? & julia/exercises/concept/cater-waiter/runtests.jl at main · exercism/julia · GitHub?

You shouldn’t be trying to alter Python test data to work on a Julia exercise. You have no idea what alterations were made in porting the exercise to Julia. Also? You shouldn’t need to view the tests to solve the problem. The introduction and tasks and a look at the Julia docs and the links provided should be enough.

2 Likes

Both of you are totally right, again!
The point was: I didn’t find the Julia tests!
And didn’t know the Constants were already included…
and before submitting the code in exercism I was testing it in the REPL,
therefore I needed the tests (and had no idea, they were already there, only at some other place!)

What’s puzzling me is:
when I startet to think what tests are neccessary here to solve it (test driven environment) I looked up, what
“Vegan”, “Vegetarian”, “Paleo”, “Keto”, “Omnivore” do mean.
And found:
“In general, a paleo diet has many features of recommended healthy diets. Common features the paleo diet has include the emphasis on fruits, vegetables, lean meats and the avoidance of processed foods.”
so paleo can be, but mustn’t be “Vegan” or “Vegetarian”

As far as I can see, the categorisation here is: only one category, so I have to think of, how to exclude all the others for my test…
or just simply iterate all the categories and find the one which dish_ingredients is subset of !!

Now when running tests, the error

VEGETARIAN` not defined in `ExercismTestReports`
VEGAN` not defined in `ExercismTestReports`

Are you running the tests online or in your local editor?

I am seeing this and this in the data for the exercise.

Are you sure there isn’t a space in there or some other issue with your setup?

Lots of people have already completed this exercise since we last revised it, so the tests are working correctly.

it only happens when I add the function calls from the task to the code:

clean_ingredients("Punjabi-Style Chole", ["onions", "tomatoes", "ginger paste", "garlic paste", "ginger paste", "vegetable oil", "bay leaves", "cloves", "cardamom", "cilantro", "peppercorns", "cumin powder", "chickpeas", "coriander powder", "red chili powder", "ground turmeric", "garam masala", "chickpeas", "ginger", "cilantro"])

check_drinks("Honeydew Cucumber", ["honeydew", "coconut water", "mint leaves", "lime juice", "salt", "english cucumber"])

check_drinks("Shirley Tonic", ["cinnamon stick", "scotch", "whole cloves", "ginger", "pomegranate juice", "sugar", "club soda"])

categorize_dish("Sticky Lemon Tofu", Set(["tofu", "soy sauce", "salt", "black pepper", "cornstarch", "vegetable oil", "garlic", "ginger", "water", "vegetable stock", "lemon juice", "lemon zest", "sugar"]))
"Sticky Lemon Tofu: VEGAN"

categorize_dish("Shrimp Bacon and Crispy Chickpea Tacos with Salsa de Guacamole", Set(["shrimp", "bacon", "avocado", "chickpeas", "fresh tortillas", "sea salt", "guajillo chile", "slivered almonds", "olive oil", "butter", "black pepper", "garlic", "onion"]))

dishes = [Set(["tofu", "soy sauce", "ginger", "corn starch", "garlic", "brown sugar", "sesame seeds", "lemon juice"]), Set(["pork tenderloin", "arugula", "pears", "blue cheese", "pine nuts","balsamic vinegar", "onions", "black pepper"]), Set(["honeydew", "coconut water", "mint leaves", "lime juice", "salt", "english cucumber"])];

compile_ingredients(dishes)

dishes_sep = ["Avocado Deviled Eggs","Flank Steak with Chimichurri and Asparagus", "Kingfish Lettuce Cups", "Grilled Flank Steak with Caesar Salad","Vegetarian Khoresh Bademjan","Avocado Deviled Eggs", "Barley Risotto","Kingfish Lettuce Cups"];
          
appetizers_sep = ["Kingfish Lettuce Cups","Avocado Deviled Eggs","Satay Steak Skewers", "Dahi Puri with Black Chickpeas","Avocado Deviled Eggs","Asparagus Puffs", "Asparagus Puffs"];
              
sort(separate_appetizers(dishes_sep, appetizers_sep)) ==
       sort(["Vegetarian Khoresh Bademjan", "Barley Risotto", "Flank Steak with Chimichurri and Asparagus", "Grilled Flank Steak with Caesar Salad"])

singleton_ingredients(example_dishes, EXAMPLE_INTERSECTION)

When they’re turned to comment:
#=
=#
it’s okay.