unit testing framework for fpc

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

unit testing framework for fpc

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?



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: unit testing framework for fpc

Michael Van Canneyt


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.

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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

how to beeeeep

Alain Michaud
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



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: unit testing framework for fpc

Dean Zobec
In reply to this post by Michael Van Canneyt
Michael Van Canneyt wrote:

>>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




_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: unit testing framework for fpc

Marc Santhoff
In reply to this post by Michael Van Canneyt
Am Montag, den 27.06.2005, 19:33 +0200 schrieb Michael Van Canneyt:

>
> 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



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Gerhard Scholz
In reply to this post by Alain Michaud
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Florian Klaempfl-2
Gerhard Scholz 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>

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.

>
> Gerhard
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Peter Vreman
In reply to this post by Gerhard Scholz
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.




Peter


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

fpdoc questions

L505
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







_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: how to beeeeep

Mailing-Listen
In reply to this post by Alain Michaud
Am Monday, dem 27. Jun 2005 schrieb Alain Michaud:

>    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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

Michael Van Canneyt
In reply to this post by L505


On Sat, 2 Jul 2005, L505 wrote:

> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

L505

| >  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.




_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

Michael Van Canneyt


On Mon, 4 Jul 2005, L505 wrote:

>
> | >  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.

>
> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

L505

|
| 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.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

L505
In reply to this post by 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 ;)


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc questions

Matt Emson
> This doesn't work:
>  -Fi\..\inc

Because the notion of '/' in Unix is completely alien in Windows. Closest
equiv is "X:\" where X is a specific drive letter. After all, '/' is the
root of the logical filesystem in most UNIX alike OS (LINUX, BSD, BeOS
etc..) You'll be wanting '~' to work next ;-) (Sometimes I wish it did
outside of Cygwin!)

M


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Jan Ruzicka
In reply to this post by Peter Vreman
On Jul 2, 2005, at 17:18, Peter Vreman wrote:

> 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Jan Ruzicka
Hi all

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

Thanks
Jan

On Jul 5, 2005, at 00:36, Jan Ruzicka wrote:

> []
> 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  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Jonas Maebe
In reply to this post by Jan Ruzicka

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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: profiler

Jan Ruzicka
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

On Jul 20, 2005, at 04:04, Jonas Maebe wrote:

>
> 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  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal