Scripts Storage

22 views
Skip to first unread message

Alec Taylor

unread,
Mar 1, 2019, 1:31:30 PM3/1/19
to mathpiper-dev
Ted,

What is the purpose of the scriptsstorage directory? Do the procedures located in scriptsstorage have to match those in src?

Alec

Ted Kosan

unread,
Mar 1, 2019, 1:38:48 PM3/1/19
to mathpi...@googlegroups.com
Alec,

In the past, large changes needed to be done to the MathPiper syntax. In order to make this work easier, I moved all the procedure definitions into scriptsstorage, moved only the procedures that were absolutely needed back into scripts4, and then did the syntax changes on the code in scripts4. Periodically I move procedures out of scriptsstorage into scripts4 as they are needed.

For the work you are doing, you can ignore the procedures that are in scriptsstorage.

Ted



--
You received this message because you are subscribed to the Google Groups "mathpiper-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathpiper-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alec Taylor

unread,
Mar 1, 2019, 3:08:55 PM3/1/19
to mathpiper-dev
I also have a question about writing tests for procedures. Should they only include calls to the Verify procedure, or can other code be included as well?

Ted Kosan

unread,
Mar 1, 2019, 3:25:10 PM3/1/19
to mathpi...@googlegroups.com
Alec wrote:

> I also have a question about writing tests for procedures. Should they only
> include calls to the Verify procedure, or can other code be included as well?

Doing a search for "automatic_test" in the scripts4 directory will
return numerous examples of what testing code looks like. Most of the
tests use only the "Verify" procedure, but some go beyond this. You
can use any testing techniques that you see in the examples. If none
of the examples provide the capabilities you need, let me know.

Ted

Alec Taylor

unread,
Mar 2, 2019, 6:35:38 PM3/2/19
to mathpiper-dev
I'm having a problem where running the tests outputs outputs global variables at the bottom, although I am using the local procedure in the automatic tests. Do you have any idea why this might be?

Ted Kosan

unread,
Mar 2, 2019, 10:24:09 PM3/2/19
to mathpi...@googlegroups.com
Alec,

Go ahead and post a copy of your test code.

Ted

Alec Taylor

unread,
Mar 2, 2019, 10:39:42 PM3/2/19
to mathpiper-dev
%mathpiper,name="IndentationTest",subtype="automatic_test"

Local(code, num, i);

code := '
    {
    num := 15;
    For(i := num, num >=? 0, num--)
    {
Echo(num);
    }
}

Verify(IndentationTest(code), "Indentation must be between 2 and 8 spaces. Near Line: 9");

code := '
{
    num := 10;
    For(i := num, num >=? 0, num--)
    {
        Echo(num);
    }
}

Verify(IndentationTest(code), True);

%/mathpiper

Ted Kosan

unread,
Mar 3, 2019, 3:02:39 PM3/3/19
to mathpi...@googlegroups.com
Alec,

The "Local" procedure is designed to work inside of a {} code
sequence. So, place all of this code inside of {} braces.

Ted

Alec Taylor

unread,
Mar 3, 2019, 3:14:22 PM3/3/19
to mathpiper-dev
 Ted,

This doesn't seem to have helped. Here is the result I am getting when I run the tests in netbeans:

***** Tests complete *****

Global variables: [closeIndex:4,closeLine:21,codeOffset:4,grandparent:
{

  num := 15;

  For(i := num,num >=? 0,num--)
  {
    Echo(num);
  }
},grandparentPosition:"",leftIndex:8,leftLine:20,openIndex:4,openLine:19,parent:(For(i := num,num >=? 0,num--)
{
  Echo(num);
}),parentIndex:4,parentLine:19,parentPosition:"2",sequence:
{
  Echo(num);
},sequencePositions:["2,4"]]
Elapsed Time: 0 min 8 sec
Maximum Evaluation Depth Reached: 320

Alec

Ted Kosan

unread,
Mar 3, 2019, 3:21:35 PM3/3/19
to mathpi...@googlegroups.com
Alec,

Do search for "grandparentPosition" in scripts4 and tell me what you find.

Ted

Alec Taylor

unread,
Mar 3, 2019, 3:34:26 PM3/3/19
to mathpiper-dev
These variables all stem from the BraceTest and IndentationTest procedures. They do not use any local procedures. I've added calls to the Local procedure to both of these and it has fixed the issue.

Ted Kosan

unread,
Mar 3, 2019, 3:36:14 PM3/3/19
to mathpi...@googlegroups.com
Did you recently add testing code to these two procedures?

On Sun, Mar 3, 2019 at 3:34 PM Alec Taylor <alecta...@gmail.com> wrote:
>
> These variables all stem from the BraceTest and IndentationTest procedures. They do not use any local procedures. I've added calls to the Local procedure to both of these and it has fixed the issue.
>

Alec Taylor

unread,
Mar 3, 2019, 4:10:46 PM3/3/19
to mathpiper-dev
Yes, I have.

Ted Kosan

unread,
Mar 3, 2019, 4:15:19 PM3/3/19
to mathpi...@googlegroups.com
Alec,

That explains why the global variables started appearing in the test log.

On a related note, I noticed that at least one procedure that was
recently documented was not placed into an existing category, and this
prevents the documentation viewer from running. Do the following from
within NetBeans::

1) Build MathPiper.
2) Run the GraphicConsole.
3) Press the "Docs" button.

Is an exception displayed in the "Output" tab?

Ted

On Sun, Mar 3, 2019 at 4:10 PM Alec Taylor <alecta...@gmail.com> wrote:
>
> Yes, I have.

Alec Taylor

unread,
Mar 3, 2019, 5:12:09 PM3/3/19
to mathpiper-dev
I did get an exception. The problem is caused by old an old header style that was used. More specifically, the header for AppendList! was using the word Function instead of Procedure and a semicolon instead of a comma.
Reply all
Reply to author
Forward
0 new messages