• Post Reply Bookmark Topic Watch Topic
  • New Topic

Test class shows error  RSS feed

 
Logan Knecht
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made an application for my class that has a functionality such of a basic calculator. It takes digits then turns then appends them to another in increasing magnitude, and once an operation is selected the digit is reset to zero so that another can be added.

Once that is done the equals method is selected and returns the answer, however I'm having a problem. I'm supposed to run it through a test, but when I use the test the only value that returns correctly is the first value, after that it just repeats the same answer over and over again.

I tried several ways to fix this, but haven't succesfully figured out what I have done wrong. If someone could take a look and just tell me if there is a way to reset it so that when runTest() in the Calculator test class performs after the first method, that it resets and repeats accordingly.

I'd really appreciate it.


 
Logan Knecht
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disregard this as I solved it by placing an if test in the digit method checking if numTest = 4 and then setting it to zero if that was the case.

Does anyone have a better suggestion on how to do this because I know this was terribly sloppy.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!