List.unit.hx 809 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var l = new List();
  2. l.toString() == "{}";
  3. l.isEmpty() == true;
  4. l.remove("1") == false;
  5. l.length == 0;
  6. l.first() == null;
  7. l.last() == null;
  8. l.pop() == null;
  9. l.add("1");
  10. l.length == 1;
  11. l.first() == "1";
  12. l.last() == "1";
  13. l.toString() == "{1}";
  14. l.isEmpty() == false;
  15. l.join("x") == "1";
  16. l.pop() == "1";
  17. l.remove("1") == false;
  18. l.length == 0;
  19. l.add("1");
  20. l.length == 1;
  21. l.remove("1") == true;
  22. l.add("1");
  23. l.push("2");
  24. l.length == 2;
  25. l.first() == "2";
  26. l.last() == "1";
  27. l.toString() == "{2, 1}";
  28. l.join("x") == "2x1";
  29. l.clear();
  30. l.isEmpty() == true;
  31. l.add("1");
  32. l.add("2");
  33. l.add("3");
  34. var l2 = l.map(function(i:String) return i + i);
  35. l2.pop() == "11";
  36. l2.pop() == "22";
  37. l2.pop() == "33";
  38. var l3 = l.filter(function(i:String) return i != "2");
  39. l3.pop() == "1";
  40. l3.pop() == "3";