Page 1 of 1

OpenVMS Pascal - testing tools?

Posted: Thu Nov 19, 2020 10:56 am
by garyrevell
Hi,

Anyone know of any unit test tools for OpenVMS Pascal?

I'm looking for something a la Java JUNIT or Python Pytest etc. I'd like to write a suite of tests for our application and using a tool would be handy. Perhaps DTM has something I could use?

Thanks

Gary

Re: OpenVMS Pascal - testing tools?

Posted: Tue Nov 24, 2020 1:50 pm
by arne_v
I am not aware of anything.

Delphi DUnit2 and Lazarus FPTest will not work with VMS Pascal.

I think it will have to be DIY.

But it is not so hard to do.

I started and got:

$ typ testdemo.pas
[inherit('demo', 'vpunit')]
program testdemo(input, output);

procedure test_add2;

var
a, b, c : integer;

begin
a := 123;
b := 456;
c := add2(a, b);
vpunit_check_integer_equals(579, c, 'add2(123, 456)');
end;

procedure test_sub2;

var
a, b, c : integer;

begin
a := 579;
b := 123;
c := sub2(a, b);
vpunit_check_integer_equals(456, c, 'sub2(579, 123)');
end;

procedure test_mul2;

var
a, b, c : integer;

begin
a := 11;
b := 12;
c := mul2(a, b);
vpunit_check_integer_equals(131, c, 'mul2(11, 12)');
end;

procedure test_div2;

var
a, b, c : integer;

begin
a := 50;
b := 3;
c := div2(a, b);
vpunit_check_integer_equals(16, c, 'div2(50, 3)');
end;

procedure test_alwaystrue;

var
b : boolean;

begin
b := alwaystrue;
vpunit_check_true(b, 'alwaystrue');
end;

procedure test_dup;

var
s, s2 : varstr;

begin
s := 'ABC';
s2 := dup(s);
vpunit_check_fixstring_equals('ABCABC', s, 'dup(''ABC'')');
end;

begin
vpunit_test(test_add2);
vpunit_test(test_sub2);
vpunit_test(test_mul2);
vpunit_test(test_div2);
vpunit_stats;
end.

$ r testdemo
Failure: expected 131 actual 23 for mul2(11, 12)
4 test run: 1 failed

Added in 5 minutes 7 seconds:
If there is interest then I could zip this stuff up and make it available for download.

But it is pretty trivial.

Re: OpenVMS Pascal - testing tools?

Posted: Wed Nov 25, 2020 5:53 am
by imiller
DTM would work if you have a license for it or DECset. Have a look at the latest DTM Guide https://vmssoftware.com/docs/VSI_DTM_GD.PDF

Re: OpenVMS Pascal - testing tools?

Posted: Wed Nov 25, 2020 8:10 am
by garyrevell
arne_v wrote:
Tue Nov 24, 2020 1:55 pm
I am not aware of anything.

Delphi DUnit2 and Lazarus FPTest will not work with VMS Pascal.

I think it will have to be DIY.

But it is not so hard to do.

I started and got:

(snip...)

Added in 5 minutes 7 seconds:
If there is interest then I could zip this stuff up and make it available for download.

But it is pretty trivial.

Thanks very much for this, unfortunately I fell at the first hurdle when trying it :
$ pas testdemo

[inherit('demo', 'vpunit')]
..........^
%PASCAL-F-FNF, file not found
at line number 1 in file MYROOT:[dev.pascal]testdemo.pas;1

%PASCAL-F-SRCERRORS, Source errors inhibit continued compilation - correct and recompile
%PASCAL-F-ENDDIAGS, PASCAL completed with 2 diagnostics
I'm a newbie to Pascal so not sure where the demo & vpunit files are/should be.

But I do like the look of the vpunit_ procedures but didn't see any documentation about them.

Thanks!

Added in 3 minutes 37 seconds:
imiller wrote:
Wed Nov 25, 2020 5:53 am
DTM would work if you have a license for it or DECset. Have a look at the latest DTM Guide https://vmssoftware.com/docs/VSI_DTM_GD.PDF
Thanks, we've got DTM and will have a more serious look at the documentation.

Re: OpenVMS Pascal - testing tools?

Posted: Wed Nov 25, 2020 8:52 am
by arne_v
The vpunit stuff is something I wrote for this.

Module demo is the module I want to unit test.

Module vpunit is the vpunit_ routines.

So right now it only exist on my system.

I can ZIP it up and make it available for download if anybody want.

Re: OpenVMS Pascal - testing tools?

Posted: Wed Nov 25, 2020 10:52 am
by garyrevell
arne_v wrote:
Wed Nov 25, 2020 8:52 am
The vpunit stuff is something I wrote for this.

Module demo is the module I want to unit test.

Module vpunit is the vpunit_ routines.

So right now it only exist on my system.

I can ZIP it up and make it available for download if anybody want.
...I can ZIP it up and make it available for download if anybody want...

Thanks Arne, that'd be great! Look forward to getting hold of the sources, will you post a link or will they be attached to a post?

I was going to try writing my own test harness using ASSERT and catching thrown exceptions etc and then realised VMS Pascal doesn't have try/except blocks.

Best regards

Gary

Re: OpenVMS Pascal - testing tools?

Posted: Wed Nov 25, 2020 7:00 pm
by arne_v
https://www.vajhoej.dk/arne/opensource/ ... c-v0_1.zip

And it is not really much.

But if you have some suggestions for improvement please tell me.

Re: OpenVMS Pascal - testing tools?

Posted: Thu Nov 26, 2020 4:22 am
by garyrevell
arne_v wrote:
Wed Nov 25, 2020 7:00 pm
https://www.vajhoej.dk/arne/opensource/ ... c-v0_1.zip

And it is not really much.

But if you have some suggestions for improvement please tell me.
Thanks a lot Arne, I'll give it a go later today. It's certainly a good approach and perhaps I can build on it too.

Best regards

Gary