Re: unit tests for 2006/02swap/euler.js please?

On Mon, 2006-02-06 at 10:57 -0600, Dan Connolly wrote:
[...]
> http://eulersharp.sourceforge.net/2006/02swap/euler.js
> 
> but I can't read the code.
> 
> I'd really like to get a version of that code with unit
> tests that explain what it's doing.
> 
> I'd even like to work on it, though I'm not sure where
> to find the time.
> 
> I see this a few times:
> 
>   s.head.charAt(0) == '?'
> 
> is that testing whether the head is a variable? Please
> factor that out as a isVar(s.head) test. DRY.

I see that's done; thanks.


> what datastructures are you passing around? what's a
> query? a lstep? That's where I'd like to see unit tests.

Thanks for explaining over the phone...

rules = {
  "a":[
    {head:{head:"a", body:[{head:":Socrates", body:[]}, {head:":Man", body:[]}]}, body:[]},
    {head:{head:"a", body:[{head:"?WHO", body:[]}, {head:":Mortal", body:[]}]}, body:[{head:"a", body:[{head:"?WHO", body:[]}, {head:":Man", body:[]}]}]}
  ]
}

goals = [{head:{}, body:[{head:"a", body:[{head:"?WHO", body:[]}, {head:"?WHAT", body:[]}]}]}]

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Tuesday, 7 February 2006 15:58:37 UTC