issue-143.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * There was an incorrect sort behaviour documented in issue #143:
  3. * (x = f(…)) <= x → x >= (x = f(…))
  4. *
  5. * For example, let the equation be:
  6. * (a = parseInt('100')) <= a
  7. *
  8. * If a was an integer and has the value of 99,
  9. * (a = parseInt('100')) <= a → 100 <= 100 → true
  10. *
  11. * When transformed incorrectly:
  12. * a >= (a = parseInt('100')) → 99 >= 100 → false
  13. */
  14. tranformation_sort_order_equal: {
  15. options = {
  16. comparisons: true,
  17. };
  18. input: { (a = parseInt('100')) == a }
  19. expect: { (a = parseInt('100')) == a }
  20. }
  21. tranformation_sort_order_unequal: {
  22. options = {
  23. comparisons: true,
  24. };
  25. input: { (a = parseInt('100')) != a }
  26. expect: { (a = parseInt('100')) != a }
  27. }
  28. tranformation_sort_order_lesser_or_equal: {
  29. options = {
  30. comparisons: true,
  31. };
  32. input: { (a = parseInt('100')) <= a }
  33. expect: { (a = parseInt('100')) <= a }
  34. }
  35. tranformation_sort_order_greater_or_equal: {
  36. options = {
  37. comparisons: true,
  38. };
  39. input: { (a = parseInt('100')) >= a }
  40. expect: { (a = parseInt('100')) >= a }
  41. }