Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-06

unit testing framework for fpc

20 messages · 12 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

Hi,

not long ago there has been some talk about a test framework for object pascal on this list. IIRC it was some sort of port of junit to pascal.

Is it in a usable state?
Where can I find it?

TIA,
Marc

P.S.: I resend this mail, the first one got lost. Maybe because I had the first word "test" in the subject?

Reply by email

Michael Van Canneyt
to Marc Santhoff
Marc Santhoff wrote 6 lines
Hi, not long ago there has been some talk about a test framework for object pascal on this list. IIRC it was some sort of port of junit to pascal. Is it in a usable state?

Very much so.

Where can I find it?

It's included with FPC by default. Sources are in fcl/fpcunit. Just include fpcunit in your source. See the examples for a console demo.

Lazarus has a special package that allows you to create either a GUI or a console test application. Compile and install lazfpcunit (or fpcunitlaz ?)

Michael.

Reply by email

Alain Michaud
to Michael Van Canneyt

Hi,

Is it still possible to produce a sound from the little speaker that is (was) present in any PC. In Delphi the command was "beep" or "sound(200,2)" or something like that !

I would apreciate if someone could tell me how to do it in FPC/Lazarus. (hopefully there is nothing to install or program! I feel lazy...)

The platform is Linux (Mandrake 10.1)

Thank you

Alain Michaud

Reply by email

Dean Zobec
to Michael Van Canneyt: Very much so. It's included with FPC by default. Sources are in fcl/fpcunit. Just include…
Michael Van Canneyt wrote 11 lines
>Where can I find it? > > It's included with FPC by default. Sources are in fcl/fpcunit. Just include fpcunit in your source. See the examples for a console demo. Lazarus has a special package that allows you to create either a GUI or a console test application. Compile and install lazfpcunit (or fpcunitlaz ?)

to be more precise:
the Lazarus package is in lazarus/components/fpcunit To install it you have to compile the package fpcunittestrunner.lpk and install the package lazarus/components/fpcunit/ide/fpcunitide.lpk

Then you can create a new unit test application with the menu: File>New>Project>FPCUnit Application (or FPCUnit Console application) You can add a new test case template by selecting
File>New>File>FPCUnit TestCase

Dean

Reply by email

Marc Santhoff
to Michael Van Canneyt: Very much so. It's included with FPC by default. Sources are in fcl/fpcunit. Just include…
Michael Van Canneyt wrote 16 lines
On Mon, 27 Jun 2005, Marc Santhoff wrote: > Hi, > > not long ago there has been some talk about a test framework for object > pascal on this list. IIRC it was some sort of port of junit to pascal. > > Is it in a usable state? Very much so. > Where can I find it? It's included with FPC by default. Sources are in fcl/fpcunit. Just include fpcunit in your source. See the examples for a console demo.

I'm impressed and pleased to hear that. :)

I assume I should refresh my compiler version from 1.9.4 to 2.0 to use it (or check out manually)?

Lazarus has a special package that allows you to create either a GUI or a console test application. Compile and install lazfpcunit (or fpcunitlaz ?)

No Lazarus involved yet, still on my list...

Thank you all,
Marc

Reply by email

Gerhard Scholz
to Alain Michaud: Is it still possible to produce a sound from the little speaker that is (was) present in…

I have problems when compiling with -pg (profiler)

Is this my fault or a compiler error?

    P:\FmtBCD>ppc386 -a -pg -Croit         -Op1 testprof
    Free Pascal Compiler version 2.1.1 [2005/06/25] for i386
    Copyright (c) 1993-2005 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling testprof.pas
    Assembling testp
    Linking testprof.exe
    o:\pp\bin\i386-win32\ld.exe: cannot find -lgcc
    testprof.pas(5,5) Error: Error while linking
    P:\FmtBCD>

Gerhard

Reply by email

Florian Klaempfl
to Gerhard Scholz
Gerhard Scholz wrote 14 lines
I have problems when compiling with -pg (profiler) Is this my fault or a compiler error? P:\FmtBCD>ppc386 -a -pg -Croit -Op1 testprof Free Pascal Compiler version 2.1.1 [2005/06/25] for i386 Copyright (c) 1993-2005 by Florian Klaempfl Target OS: Win32 for i386 Compiling testprof.pas Assembling testp Linking testprof.exe o:\pp\bin\i386-win32\ld.exe: cannot find -lgcc testprof.pas(5,5) Error: Error while linking P:\FmtBCD>

You need libgcc from e.g. cygwin. But I must admit, I'am not sure if profiling using gprof works on win32. I usually profile under linux using callgrind.

Show quoted text 6 lines
Gerhard _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Peter Vreman
to Gerhard Scholz: I have problems when compiling with -pg (profiler) Is this my fault or a compiler error?…
you wrote 14 lines
I have problems when compiling with -pg (profiler) Is this my fault or a compiler error? P:\FmtBCD>ppc386 -a -pg -Croit -Op1 testprof Free Pascal Compiler version 2.1.1 [2005/06/25] for i386 Copyright (c) 1993-2005 by Florian Klaempfl Target OS: Win32 for i386 Compiling testprof.pas Assembling testp Linking testprof.exe o:\pp\bin\i386-win32\ld.exe: cannot find -lgcc testprof.pas(5,5) Error: Error while linking P:\FmtBCD>

Profiling under win32 has only be tested in the past under cygwin. Don't know if it still works. I only have used linux for profiling. From which the last 2 years were only with calltree&kcachegrind.

Peter

Reply by email

L505
to Peter Vreman

Question 1:

fpdoc --package=rtl --input="system.pp -Fi/directory/"

Is that the correct syntax? I can't get it to find my include files that it needs. I am putting the quotes in the wrong place maybe..

Question 2:

Can you use an fpc.cfg file with fpdoc?

thanks and regards,
Lars

Reply by email

Andres K. Foerster
to Alain Michaud: Is it still possible to produce a sound from the little speaker that is (was) present in…
Alain Michaud wrote 8 lines
Is it still possible to produce a sound from the little speaker that is (was) present in any PC. In Delphi the command was "beep" or "sound(200,2)" or something like that ! I would apreciate if someone could tell me how to do it in FPC/Lazarus. (hopefully there is nothing to install or program! I feel lazy...) The platform is Linux (Mandrake 10.1)
Well for a simple beep you can use
Write(#7);

There is a procedure called Beep im SysUtils, but strangely it does nothing under Linux...?

AKFoerster

Reply by email

Michael Van Canneyt
to L505: Question 1: fpdoc --package=rtl --input="system.pp -Fi/directory/" Is that the correct…
L505 wrote 6 lines
Question 1: fpdoc --package=rtl --input="system.pp -Fi/directory/" Is that the correct syntax? I can't get it to find my include files that it needs. I am putting the quotes in the wrong place maybe..

No, the syntax is correct.

Question 2: Can you use an fpc.cfg file with fpdoc?

No.
I'm planning support for a fpdoc.cfg file, though.

Michael.

Reply by email

Michael Van Canneyt
to L505: | > fpdoc --package=rtl --input="system.pp -Fi/directory/" | > | > Is that the correct…
L505 wrote 26 lines
| > fpdoc --package=rtl --input="system.pp -Fi/directory/" | > | > Is that the correct syntax? I can't get it to find my include files that it | > needs. I am putting the quotes in the wrong place maybe.. | | No, the syntax is correct. | I tried using absolute paths for the unit I am running fpdoc on, everything and it is working now. For example to make sure the sysunixh.inc is found properly I must go fpdoc --package=rtl --input="/home/l1/FPC/source/fpc2.0.0/rtl/linux/system.pp -F i/home/l1/FPC/source/fpc2.0.0/rtl/unix/;" as opposed to running fpdoc in a local directory: fpdoc --package=rtl --input="system.pp -Fi/home/l1/FPC/source/fpc2.0.0/rtl/unix/ ;" Can't find unit sysunixh.inc Is that normal behaviour?

Normally, relative paths should work. Try using ./system.pp

I was going to run FPDOC in a local directory for convenience. If it should work locally, I will look at the sources and work on a local fpdocompiling patch.

Please do.

Show quoted text 5 lines
Lars p.s. I really do like this way, versus embedded source help messes I've seen. definitely clean and automated.

That is one of the principal reasons why fpdoc was developed: strict separation of sources and documentation.
Sources with _serious_ documentation embedded are not really easy to browse or maintain.

Michael.

Reply by email

L505
to Michael Van Canneyt: No, the syntax is correct. No. I'm planning support for a fpdoc.cfg file, though. Michael.

| > fpdoc --package=rtl --input="system.pp -Fi/directory/" | >
| > Is that the correct syntax? I can't get it to find my include files that it | > needs. I am putting the quotes in the wrong place maybe.. |
| No, the syntax is correct.
|

I tried using absolute paths for the unit I am running fpdoc on, everything and it is working now.

For example to make sure the sysunixh.inc is found properly I must go

fpdoc --package=rtl --input="/home/l1/FPC/source/fpc2.0.0/rtl/linux/system.pp -F i/home/l1/FPC/source/fpc2.0.0/rtl/unix/;"

as opposed to running fpdoc in a local directory:

fpdoc --package=rtl --input="system.pp -Fi/home/l1/FPC/source/fpc2.0.0/rtl/unix/ ;"

Can't find unit sysunixh.inc

Is that normal behaviour? I was going to run FPDOC in a local directory for convenience. If it should work locally, I will look at the sources and work on a local fpdocompiling patch.

Lars

p.s. I really do like this way, versus embedded source help messes I've seen. definitely clean and automated.

Reply by email

L505
to Michael Van Canneyt: Normally, relative paths should work. Try using ./system.pp Please do. That is one of the…

|
| Normally, relative paths should work. Try using ./system.pp

Yes that worked on linux. Well, I'll try some things on win32 .. not sure what the equivilent of ./ is on windows.

is there a:
.\
on windows?

| That is one of the principal reasons why fpdoc was developed: | strict separation of sources and documentation.
| Sources with _serious_ documentation embedded are not really easy to browse or maintain.
|

Yes I agree. it seems to be a temptation to want to place the docs right in the source for some people. All one has to do is open up a text editor along side of the source code, and document it side by side. If one was ambitious enough, a program could be created so that the descriptor file automatically opened up when a source code unit was opened.

The only way I see embedded source as a possible solution is if the IDE has a switch or setting on it where you can turn off or hide all the embedded documentation. But I'd still rather keep it separate, because that would just add more bloat to the IDE code.

Reply by email

L505

| is there a:
| .\
| on windows?

Okay, to answer my own question...now I see. Just some simple syntax misunderstandings.

On win32
------------
This works:
-Fi..\inc

This doesn't work:
-Fi\..\inc

On GnuLinux
--------------

This works
input="./system.pp -Fi../unix/"

This doesn't work
input="system.pp -Fi../unix/"

On Mac and other
--------------------
Not sure ;)

Reply by email

Jan Ruzicka
to Peter Vreman: Profiling under win32 has only be tested in the past under cygwin. Don't know if it still…
Peter Vreman wrote 20 lines
At 10:06 2-7-2005, you wrote: > I have problems when compiling with -pg (profiler) > > Is this my fault or a compiler error? > > P:\FmtBCD>ppc386 -a -pg -Croit -Op1 testprof > Free Pascal Compiler version 2.1.1 [2005/06/25] for i386 > Copyright (c) 1993-2005 by Florian Klaempfl > Target OS: Win32 for i386 > Compiling testprof.pas > Assembling testp > Linking testprof.exe > o:\pp\bin\i386-win32\ld.exe: cannot find -lgcc > testprof.pas(5,5) Error: Error while linking > P:\FmtBCD> Profiling under win32 has only be tested in the past under cygwin. Don't know if it still works. I only have used linux for profiling. From which the last 2 years were only with calltree&kcachegrind.

Was the profiling tested under OS X?
Assembling tfmtbcd
Linking TFMTBCD
/usr/bin/ld: unknown flag: -dynamic-linker=
TFMTBCD.pp(328,4) Error: Error while linking
Error: /usr/local/bin/ppcppc returned an error exitcode (normal if you did not specifiy a source file to be compiled)

Thanks
Jan

Reply by email

Jan Ruzicka
to Jan Ruzicka

Hi all

is there a way to remove the '-dynamic-linker=' flag ?

Thanks
Jan

Jan Ruzicka wrote 18 lines
[] Was the profiling tested under OS X? Assembling tfmtbcd Linking TFMTBCD /usr/bin/ld: unknown flag: -dynamic-linker= TFMTBCD.pp(328,4) Error: Error while linking Error: /usr/local/bin/ppcppc returned an error exitcode (normal if you did not specifiy a source file to be compiled) Thanks Jan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Jan Ruzicka
to Jonas Maebe

That is really a great tool.
It shows even how is the assembler mapped to the source code. I was surprised when I learned that 90% of time spent in my function goes to a result assignment stalling the processor.

the usual
function f : TStructure
var
    b: TStructure;
begin
     ... some processing on b ...
     f := b;
end;

Jan

Jonas Maebe wrote 20 lines
On 05 Jul 2005, at 06:36, Jan Ruzicka wrote: > Was the profiling tested under OS X? No, but I would urge you to use Shark from CHUD (http://developer.apple.com/tools/performance/overview.html) It's much better and versatile than gprof, and only requires regular debugging information to work. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email