0

I don't know what the expression is in english, but what I mean is that code you use to make sure the code is correct, every possible case works, and the program is doing what it's supposed to (like, if I make code to operate with a matrix, I want to be sure it works with 3x3, 5x100 and all kinds of matrix, that's what I mean with test code).

So I have to make this project for the university, where the main problem is that as of right now, I do not know how to make test code, so I'm writing code I can not test.

I do have some experience with assembly, last year we had to do a huge project in assembly, but it was 88k, this year is 68k and is also kind of huge.

The project itself is about I/O, I have to make it so it works reading and writing in a "buffer" (DUART is called: MC68681 DUART, and the assembler itself is called MC68000 I believe).

So I'd have to order it to write something in the buffer and check that it IS being sent, and after I'd like to check if when I tried to read the byte, it did it properly, and so on.

Please tell me if I should add any more info or explain myself better, it's quite hard to express this concepts on english.

keont
  • 653
  • 1
  • 9
  • 26

1 Answers1

0

well, it seems you know what the program is supposed to do right?

next step is to break it into parts and purposely break each part. This is kinda like making algorithms, get the basic idea of what the program does step by step... 1. it does this; 2. it does this; 3. then this; 4. another step and so on until its done running.

For each part of the program: - Define what it does - Make a method to test for the correct values - Make other methods to purposely test for incorrect values(in other words - break it).

Make a test that you know what values will be output, use your methods and see if they are all correct.

MGHandy
  • 363
  • 1
  • 3
  • 11
  • That's exactly the problem. Right now, it's not like I know PERFECTLY every method, but what you say about breaking each part is done. Probably not perfectly, but it's done, I'm building each of the "easiest" parts so I can after that glue everything together. Is the part about testing I have no clue how to do it. What values, how to start the program running, like, anything at all, I have seen barely 1 example, and a poor one, so I'm quite lost. – keont Oct 27 '13 at 19:03
  • Sorry to leave ya hangin. I was trying to figure out a better way to explain, it's rather difficult sometimes. I found a link that might help you as well. http://sydney.edu.au/engineering/it/~soft1002/java_expository/testing.html – MGHandy Oct 28 '13 at 14:43
  • The best way I can figure to test is write a separate test class to test all of your methods, what you do is in this test class set predefined values or(expected values) to pass into your original program. Test values that are going to break it and values that you know will be accepted. if something happens to break when it shouldn't, go back in and fix it then run your tests again until you figure everything out. – MGHandy Oct 28 '13 at 14:46
  • No problem about the hanging part. About your second comment, that's exactly what I want to do, I just don't know how to make the DUART start sending bytes so I can test if I get them back, I don't know to make a main program that gives the correct info so the methods can be tested, and so on. That's the tricky part, I think I lack understanding on the assembler to make that. Checking the link right now – keont Oct 28 '13 at 18:11
  • Sorry to keep it so vague but since it's a university project I wasn't sure what the rules are about what can I put from the problem statement itself. – keont Oct 28 '13 at 18:14
  • I found a whole thing on 68000 assembly programming that might be of use: [link](http://hcvgm.org/Data_Sheets/Motorola/6800%20Assembly%20Language%20Programming%20%28Lance%20Leventhal%29%281978%29.pdf). Sorry I cannot be of much more help, i'm not too familiar with assembly programming. – MGHandy Oct 29 '13 at 21:04
  • It's ok man, so far you've helped more than anyone else. That link seems really usefull, at first I thought it would be [this other manual](http://www.freescale.com/files/archives/doc/ref_manual/M68000PRM.pdf) But yours is probably the best written book I've seen, programming-related. And I saw it has loads of examples, so I feel like I found a gold mine. ofc it's 400 pages so it will cost some time but I think Ill get something out of that – keont Oct 30 '13 at 07:57
  • I'm glad I could give you something useful, I looked through the table of contents and found some relevant stuff and went to actually skim through those sections it looked like it would help so I sent the link to it. There were about 10 million different things I found but none looked all that useful. – MGHandy Oct 30 '13 at 23:26