flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Automatic unit tests for FASM projects.

Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Jan 2013, 19:47
It is not an existing project (sorry if the subject misled you). I think sometimes about a system that to allow easy testing of assembly written libraries that contains tens or even hundred procedures.

IMO, the test code must be defined directly in the source code of the library, near the procedure that is to be tested.
This approach will provide high consistency between the test code and the code under test - i.e. if I change the procedure, I can directly change the test as well.

So, then, the application code that will provide the test itself, should be automatically created without manually referring the particular procedures.

All these thoughts are only very sketchy. I even blurry imagine the possible syntax. The implementation is even less clear. (more, I vaguely imagine what "unit test" actually means. Usually this therm is used in relation with OOP.)

So, with this topic I would like to appeal for some discussion that to clean the problem and to outline some ways for possible implementation.

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 08 Jan 2013, 19:47
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1670
Location: Toronto, Canada
AsmGuru62 08 Jan 2013, 23:45
Very cool idea!

I would define a procedure as something, which has input and output.
Without these terms - we can't test the procedure. Even if procedure
somehow changes the state of global variables - it is still an output.

However, how to test the functions, which supposed to draw something
on screen. Say, I have a function called "Line":
Code:
stdcall Line, 100, 100, 389, 14
    

How to write a unit test which would prove that line was indeed drawn from
point (100,100) to point (389,14) and not to (388,14)? Pretty hard.

However, most of the code can be considered testable.
Also, unit test code should be included into some kind of conditional
assembly, to be switched ON/OFF as desired.

But the idea is very cool.
Post 08 Jan 2013, 23:45
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 09 Jan 2013, 00:01
The graphics procedures and all other memory processing procedures can be easy tested, comparing the result memory block with some reference memory block produced by some other way.
Post 09 Jan 2013, 00:01
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 843
Location: Jakarta, Indonesia
TmX 10 Jan 2013, 02:59
Yes, unit testing is used nowadays in application development (some programming languages even has built-in unit testing mechanism), and it would be cool if such thing also available for assembly.

Actually it's not related to OOP. There is CUnit (unit testing for C), for example:
http://cunit.sourceforge.net/example.html
Post 10 Jan 2013, 02:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.