Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Everything posted by bjkrug

  1. Mocking data in assembly hasn't been a lot harder for me than mocking data in C#. Mocking routines could eventually get hairy; I've only had to do a little bit of that so far. If a mocked routine is supposed to return different values under different circumstances, then something needs to be done in the Arrange portion of the test to specify that. That can sacrifice legibility. And, yeah, I'm writing tests for memory management and array algorithms. If I were writing a game, my test coverage would be way lower, if not zero. As far as I know, modularizing code enough for unit testing could impact game performance.
  2. Does anyone here write unit tests for your Assembly Language projects? What is your preferred coding format for doing so? The below is my approach. ARYINS is the routine being tested. AEQ and ANEQ stand for "Assert Equal" and "Assert Not Equal", respectively. They are comparing the contents of R0 and R1. * * Insert an element at the middle of * an array. * Grow array and move it. * No empty block follows the original. INS5 * Arrange LI R0,INS5Y MOV R0,@BUFADR LI R0,INS5Z MOV R0,@BUFEND * Act LI R0,INS5X+2 LI R1,3 BLWP @ARYINS MOV R0,R9 MOV R1,R10 * Assert LI R0,INS5X+2 MOV R9,R1 BLWP @ANEQ TEXT 'Array should have moved.' BYTE 0 EVEN * MOV R9,R0 AI R0,4+12 MOV R10,R1 BLWP @AEQ TEXT 'Element address should be ' TEXT 'directly after the third ' TEXT 'element.' BYTE 0 EVEN . . . RT
  • Create New...