Commits

Cat's Eye Technologies committed 38a2cf6

Add test driver. Three passing tests in a Falderal test suite.

  • Participants
  • Parent commits 3695b09

Comments (0)

Files changed (8)

 You need an Erlang compiler at least at language version 4.4 to compile
 `granolam.erl`.  This program was developed with OTP/R8B, so that is the
 recommended platform for using it, although more recent versions should
-work as well.
+work as well.  (It has recently been tested with R17.)
 
 To build the `granolam` module, run the script `make.sh`.
 
-After the module is built, run the script `granolam` in the `bin` directory
-to start a GraNoLa/M shell.
+After the module is built, run the script `granolam_shell` in the `bin`
+directory to start a GraNoLa/M shell.
+
+Or you can run `bin/granolam` _filename_ to run a GraNoLa/M program
+written in a text file on the filesystem.  This uses `escript`, so you
+don't have to build the module first.  But you need `realpath`.
 
 To run the built-in test cases, start an Erlang shell and run
 
+#!/bin/sh
+
+THIS=`realpath $0`
+escript `dirname $THIS`/../src/granolam.erl $*

doc/GraNoLa-M.markdown

 *   `bejadoz` - input a graph (in GraNoLa/M syntax) and push it on the stack
 
 Tests
+-----
 
     -> Functionality "Interpret GraNoLa/M Program" is implemented by
-    -> shell command "bin/granolam %(test-body-file)"
+    -> shell command "bin/granolam %(test-body-file) | head --bytes=60"
 
     -> Tests for functionality "Interpret GraNoLa/M Program"
 
+Here are some tests.  They all loop infinitely, so we only look at the
+first 60 bytes of output.
+
     | a=^#cthulhu(b=^uwaming(^a))
-    = ??
+    = ^cthulhu ^cthulhu ^cthulhu ^cthulhu ^cthulhu ^cthulhu ^cthul
 
     | a=^whebong(b=^uwaming(^a))
-    = ??
+    = a=^whebong(b=^uwaming(^a)) a=^whebong(b=^uwaming(^a)) a=^whe
 
     | a=^0hello(b=^@hello(c=^taug(d=^uwaming(^a))))
-    = ??
+    = embed=stack(hello())() embed=hello(hello())() embed=hello(he
 
-    | a=^1hello(b=^uwaming(end=() hello=(world())))
-    = ??
-
-    | a=^sajalom(b=^#d(c=^bimodang(^a))
-    = ??
-
-    | d(e=^#sakura(f=^uwaming(g=^ubewic()))))
-    = ??
-
-    | a=^sajalom(b=^bejadoz(c=^soduv(^a d())))
-    = ??
+The other tests in the suite in the code don't seem to work.  Pity.

eg/example1.granolam

+a=^#cthulhu(b=^uwaming(^a))

eg/example2.granolam

+a=^whebong(b=^uwaming(^a))

eg/example3.granolam

+a=^0hello(b=^@hello(c=^taug(d=^uwaming(^a))))

eg/example4.granolam

+a=^1hello(b=^uwaming(end=() hello=(world())))
-#!/usr/bin/env escript
-%% -*- erlang -*-
-
 -module(granolam).
 -vsn('2002.0314').  % This work is a part of the public domain.
 
 %% Script Interface ------------------------------------------------------
 
 main([N]) ->
-  {ok, b} = file:read_file(N),run(binary_to_list(b)).
+  {ok,B} = file:read_file(N),run(binary_to_list(B)).