test-forth.joy 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. (* test-forth.joy -- tests for forth.joy
  2. Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
  3. Joy is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free
  5. Software Foundation; either version 3 of the License, or (at your
  6. option) any later version.
  7. Joy is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  9. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  10. License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with Joy. If not, see <http://www.gnu.org/licenses/>.
  13. *)
  14. "forth" include
  15. "inicheck" include
  16. DEFINE
  17. test-drop == "drop" [1 2 3 drop] satisfies [2 =] ? ;
  18. test-over == "over" [1 2 over] satisfies [1 =] ? ;
  19. test-nip == "nip" [1 2 3 nip] satisfies [3 = [1 =] dip and] ? ;
  20. test-tuck == "tuck" [1 2 tuck] satisfies [2 = [1 = [2 =] dip and]
  21. dip and] ? ;
  22. test-rot == "rot" [1 2 3 rot] satisfies [1 =] ? ;
  23. test--rot == "-rot" [1 2 3 -rot] satisfies [2 =] ? ;
  24. test-pick == "pick" [1 7 3 4 2 pick] satisfies [7 =] ? ;
  25. test-forth ==
  26. test-drop
  27. test-over
  28. test-nip
  29. test-tuck
  30. test-rot
  31. test--rot
  32. test-pick ;
  33. END
  34. test-forth