Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > c64unit test framework - alpha version
2017-07-30 20:42
Bago Zonde

Registered: Dec 2010
Posts: 29
c64unit test framework - alpha version

Hi guys!

I would like to announce that c64unit unit test framework entered alpha stage. If you have any feedback, feel free to share here. Any suggestions are welcome!

c64unit framework package: https://bitbucket.org/Commocore/c64unit
Examples: https://bitbucket.org/Commocore/c64unit-examples

And this is the place where c64unit was born, while working on A* pathfinding algorithm for Steel Duck game project (still in progress): A* pathfinding algorithm repository.

Currently c64unit supports 4 cross-assemblers: 64tass, DASM, Kick Assembler and ACME. Please let me know if your cross-assembler of choice is missing here.

Happy testing!

Hail C64 scene!

www.commocore.com
2017-08-01 08:41
Claus_2015

Registered: Oct 2012
Posts: 53
Nice work! I have something similar in use, but somewhat simpler and targeted for my own personal use. I feel that supporting ca65 syntax might be good, as this is definitely my (and maybe others'?) choice for large projects that rely on a separation between compiler and linker.
2017-08-02 21:18
AlexC

Registered: Jan 2008
Posts: 299
I wonder what are differences between this project http://64bites.com/64spec/ and yours with exception of supporting multiple assemblers? Never had time to check out both project so I am asking out of curiosity.
2017-08-03 22:58
Bago Zonde

Registered: Dec 2010
Posts: 29
@AlexC
There were few reasons behind creating unit test framework, but to fully answer your question I will try to explain it from the beginning. Well, this is my understanding, so if you have other opinions, feel free to discuss here :).

The genesis of c64unit is simply a need to test one algorithm I was working on. And, as 64tass is my cross-assembler of choice (which I adore, and I don't regret even for a second), I just created few simple assertions in 64tass. I was aware of 64spec at the time, but as I wasn't able to use it with 64tass, that was the natural direction.

64spec seems to be a quite powerful tool, but even though, it doesn't contain assertions for set of data as far as I've seen. You can assert set of bytes using assert_bytes_equal pseudocommand but this one is actually static. In my case I needed to introduce data providers, which can do two things. First of all, they are dynamic, which means that result from examined function can be asserted against expected value on the fly. And the second, these handlers are able to set input parameters for called function (A, X, Y registers, etc.) and also, you can set any address locations before calling the function if you have to. Then you can execute the function, and make dynamic assertion to compare with your expected value. Operation continues in loop until the last expected iteration of data set. This behaviour was a must have in my case as algorithm needed a variety of data to be initialized for each test case.

You'll find the real world example here: https://bitbucket.org/Commocore/a-star-pathfinding-in-6510/src/..

So, that was something asking to be implemented. Then, after couple of months I realized, that it started to be an extremely handy tool for me so I started to hunt for features I'm missing.

And then, I've found that actually I have to mock some functionality! So this is another difference that c64unit can mock/stub some functions, while 64spec cannot.

After all that crazy time when I was creating all that features, I realized that it's actually not a bad idea to make it available for our community. And from then, I think I became crazy myself when the idea of enabling it for a variety of cross-assemblers came to my mind. Challenging mostly in terms of time spent, but as I've found again - everything is possible, and what's impossible just takes more time :).

To conclude, the main difference is the approach taken, I believe. 64spec is focusing on low-level testing of assembly code, while c64unit took a different approach, and it's focused on unit testing. I really found 64spec an interesting tool, and inspiring though.

But the direction I went is quite different now, and as c64unit is in alpha version, I will see how it can be extended for additional features. Feel free to share some ideas :).

www.commocore.com
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
algorithm
Peacemaker/CENSOR/Hi..
wil
Barfly/Extend
MWR/Visdom
Andy/AEG
Guests online: 99
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.036 sec.