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: 293
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
t0m3000/ibex-crew
Holy Moses/Role
CA$H/TRiAD
Krill/Plush
Guests online: 177
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Lobo  (9.7)
4 Mikael  (9.7)
5 Archmage  (9.7)

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