-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
add linked list exercise #156
add linked list exercise #156
Conversation
hmm. The build fails for macos. I'll test more. |
So without disabling pie I am not able to get nasm to call libc functions on linux
I saw some workarounds like using
In current state it works fine on my mac - intel, 2019, Big Sur 11.6.3 and ubuntu/alpine docker in this state. Additionally I tested a change with plt too. |
Thanks for submitting this PR! @bergjohan Could you look at this PR? |
I'll try to take a look tomorrow |
Thanks for the PR, nice work! A few thoughts: When I created this track, I avoided exercises with dynamic allocation, since it's very OS dependent. I'm not sure how I feel about forcing the student to use the C standard library in an assembly track. The student would have to learn how to use the functions
To avoid dynamic memory allocation, maybe we could pre allocate some memory in the .bss section, enough to handle the test cases, i.e have the linked list be fixed size. Something like This is just some thoughts to get a discussion going on what the best way to implement this exercise would be. |
Calling I'll move the struct defs from c to asm - that makes sense. |
@bergjohan Did these changes - based on your thoughts
|
Thanks, great work! Some additional thoughts:
|
The list needs to be a new one for each test. The tests will fail if we don't clear the state from last test - |
Yeah, I was thinking we could add a function, If you think the current way is better, that's fine, I'm just trying to think of ways to simplify the exercise and make it as clear as possible to the student what's expected of them. |
IMO a |
My bad, a call to |
I have made changes for the first 4 points. I still feel that keeping the List as a struct with a couple of pointers is OK. |
Ah Its been a "while". Sorry I totally forgot about this - the current change should do everything you suggested @bergjohan |
Adding linked list exercise from https://github.com/exercism/problem-specifications/tree/main/exercises/linked-list
Example solution passed the build
[x86-64-assembly] \cat /tmp/out/results.out linked_list_test.c:232:test_pop_gets_element_from_the_list:PASS linked_list_test.c:233:test_pushpop_respectively_addremove_at_the_end_of_the_list:PASS linked_list_test.c:234:test_shift_gets_an_element_from_the_list:PASS linked_list_test.c:235:test_shift_gets_first_element_from_the_list:PASS linked_list_test.c:236:test_unshift_adds_element_at_start_of_the_list:PASS linked_list_test.c:237:test_pop_push_shift_and_unshift_can_be_used_in_any_order:PASS linked_list_test.c:238:test_count_an_empty_list:PASS linked_list_test.c:239:test_count_a_list_with_items:PASS linked_list_test.c:240:test_count_is_correct_after_mutation:PASS linked_list_test.c:241:test_popping_to_empty_doesnt_break_the_list:PASS linked_list_test.c:242:test_shifting_to_empty_doesnt_break_the_list:PASS linked_list_test.c:243:test_deletes_the_only_element:PASS linked_list_test.c:244:test_deletes_the_element_with_the_specified_value_from_the_list:PASS linked_list_test.c:245:test_deletes_the_element_with_the_specified_value_from_the_list_reassigns_tail:PASS linked_list_test.c:246:test_deletes_the_element_with_the_specified_value_from_the_list_reassigns_head:PASS linked_list_test.c:247:test_deletes_the_first_of_two_elements:PASS linked_list_test.c:248:test_deletes_the_second_of_two_elements:PASS linked_list_test.c:249:test_delete_does_not_modify_the_list_if_the_element_is_not_found:PASS linked_list_test.c:250:test_deletes_only_the_first_occurrence:PASS ----------------------- 19 Tests 0 Failures 0 Ignored OK