Skip to content
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

Test is missing for the function "reorder" of the exercice "Tetragon" #42

Open
ghost opened this issue Feb 27, 2024 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Feb 27, 2024

Hi,

I actually test  Introduction te Functionnal Programming (MOOC) . The exercice  Tetragon  asks to write a function reorder . The verification test is incomplete, because all values that this incorrect function returns are considered as correct in the report :

let reorder (p1, p2, p3, p4) = 
  let l = List.sort (fun p p' -> compare (fst p) (fst p')) [p1; p2; p3; p4] in
  let llp = List.nth l 0 in
  let lup = List.nth l 1 in
  let rup = List.nth l 2 in
  let rlp = List.nth l 3 in
  (lup, rup, llp, rlp);;

If you test this function with a well formed tetragon, the points become disordered :

reorder  ((-4,3), (4,4), (-3,-2), (3,-4));;
- : (int * int) * (int * int) * (int * int) * (int * int) = ((-3, -2), (3, -4), (-4, 3), (4, 4))

Maybe teatchers of this exercice should add this test ?

bug_reorder_function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants