exercism / x86-64-assembly

Exercism exercises in x86-64 Assembly.
https://exercism.org/tracks/x86-64-assembly
MIT License
22 stars 18 forks source link

exercises: add triangle #157

Closed sudhackar closed 2 years ago

sudhackar commented 2 years ago

Adding another exercise triangle : https://github.com/exercism/problem-specifications/tree/main/exercises/triangle

This adds the concepts for handling floats in assembly.

Additionally I might raise a bug in generator - when we flatten the array, we lose the context of tests. Worked with the following diff

diff --git a/generators/generate b/generators/generate
index d058f1f..20baa66 100755
--- a/generators/generate
+++ b/generators/generate
@@ -30,6 +30,7 @@ def flatten_cases(data):
     for i in data["cases"]:
         if "cases" in i:
             for j in i["cases"]:
+                j["description"] = i["description"] + " " + j["description"]
                 cases.append(j)
         else:
             cases.append(i)
ErikSchierboom commented 2 years ago

Thanks! One for you too @bergjohan

sudhackar commented 2 years ago

ping @bergjohan

bergjohan commented 2 years ago

Thanks for the PR, looks good!

@ErikSchierboom Feel free to approve and merge it!

bergjohan commented 2 years ago

Wait, could you update the assembly files with the changes in https://github.com/exercism/x86-64-assembly/pull/161 before merging?

sudhackar commented 2 years ago

Done. Updated the example solution and the template.

bergjohan commented 2 years ago

Perfect, thank you!

bergjohan commented 2 years ago

Wait, there seems to be an error on macOS:

triangle.asm:95: error: segment name `.note.GNU-stack' not recognized

bergjohan commented 2 years ago

Try the following instead:

%ifidn __OUTPUT_FORMAT__,elf64
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
sudhackar commented 2 years ago

@bergjohan or @ErikSchierboom Can you approve the CI workflow on #161. Lets see once that change is tested and fixed.

ErikSchierboom commented 2 years ago

@bergjohan Done. Looks to be good. Want me to merge?

bergjohan commented 2 years ago

Yes you can merge it, thank you!