-
-
Notifications
You must be signed in to change notification settings - Fork 202
Revised Lasagna concept exercise #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
OK, leave it with me. I need to learn how to fix the errors. I took the liberty of shortening the name to |
updated filename
added final newline
added final newline
update UNITY_END();
I fixed several of the initial CI errors (updating unity syntax, which seems to have changed a bit since #765), but I'm running out of ideas for all the Is # Copy the examples with the correct name for the exercise
if [ -e ".meta/example.c" ]
then
mv .meta/example.c ./"${exercise_name}".c
fi
if [ -e ".meta/example.h" ]
then
mv .meta/example.h ./"${exercise_name}".h
fi I can't see any mention of |
Hi @colinleach , The tests run on files .h and .c files that use the exercise name as the file name. This is why in #765 the following is added in run-tests, note the "examplar" file names used: # Copy the examples with the correct name for the concept exercise
if [ -e ".meta/exemplar.c" ]
then
mv .meta/exemplar.c ./"${exercise_name}".c
fi
if [ -e ".meta/exemplar.h" ]
then
mv .meta/exemplar.h ./"${exercise_name}".h
fi Possibly the logic of this bash function could be further improved so that it handles examplars OR examples OR it throws and error, rather than just carrying on after zero moves. This further improvement of throwing an error need not be part of this PR though. |
It is because you name your example implementation
I'm not sure why the C track deviates from the standard naming. Anyway,
I believe this is only used by exercism website tooling to know which files to show to mentors as the standard solution. It is not used by |
Why would we want to support two different naming schemes? |
example.c is the standard naming for practice exercises. |
Sorry, Ive checked the docs (first time in a long while). you have a valid point @ahans You can see in the docs here for a practice exercise that it seems to have changed at some point that the example files can use any name that suits the track as long as it is specified in the config.json. I see the same is true now for concept exercises, where again it is fine to use any name as long as the config.json specifies it. So then, we perhaps could align to "example" as the file name even in concepts, then the changes to the run-tests are not needed (thought the error catching improvement may still be valid) |
@@ -0,0 +1,14 @@ | |||
// Please do not edit this file. It will be explained in a later Concept. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about not providing this file at all and instead putting the declarations into test_lasagna.c
? Alternatively, we could just #include "lasagna.c"
from test_lasagna.c
(that's what the C++ version does). Students would see only the lasagna.c
template, so it doesn't matter which approach we use. But not having a header file would lower the chance for confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wolf99 @ryanplusplus What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahans I haven't read through all the comments yet... is the intent to avoid introducing headers at this point? If so, I think this makes sense. It's weird to do either of these workarounds, but only to someone who is already familiar enough with C to be able to reason through the weirdness. I expect anyone who's just learning C to not even notice because they're focused on the basics.
I'd prefer including lasagna.c
in the test file if we have to pick a path.
exercises/concept/lasagna/makefile
Outdated
|
||
tests.out: ./*.c ./*.h | ||
@echo Compiling $@ | ||
@$(CC) $(CFLAGS) test-framework/unity.c ./*.c -o tests.out $(LIBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure all non-empty files end with an EOL character.
@@ -0,0 +1,54 @@ | |||
#include "test-framework/unity.h" | |||
#include "lasagna.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relating to my previous comment, we would replace this line like this and remove lasagna.c
:
#include "lasagna.h" | |
#include "lasagna.c" |
It's probably a historical accident, but now most/all other tracks with learning exercises use
Above my pay grade! I'll keep out of this, and comply with whatever the C maintainers decide. |
Thanks, I didn't know this. Haven't really looked at concept exercises yet. So at least the C++ track as well as the Python track follow the |
Personally, I'd just use |
For the Python track, we use If someone complains that a Python However, if someone complains that an We also have more elaborate stub files for concept exercises, with detailed docstrings, and tests that are much more verbose and detailed with their error messages. We try (and most likely fail) to make everything about the concept exercises something students could copy in their own code an not be "called out" as not coding "correct" Python. The other key difference is that concept exercise tests are not exposed to students in the web UI. So students need to have clearer instructions and stubs for concept exercises, since they won't be able to see additional test expectations. So naming the two solution types differently helps to keep things easy to identify, since we do treat the two types differently in a bunch of ways. But a test script could as easily key off the repo folders or the |
Thanks for the detailed explanation of the relevant background, @BethanyG, it makes much more sense now. Even before understanding the intended meaning of |
I agree, my vote is to go with |
Context:
This is my first C submission, so I hope I got it all right! When offering constructive criticism, remember that I am neither emotionally-sensitive nor litigious...