Advertisement
Guest User

Untitled

a guest
May 6th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. Eclipse version to use:
  2. =======================
  3. -- Use `Eclipse Luna SDK`
  4.  
  5. When importing the prac code into the package:
  6. ==============================================
  7. -- Remember that the package structure must match what it says in the file;
  8. i.e., if the file says "package week4", then the file needs to be in a
  9. package called week4!
  10. -- You need to add the JUnit library to your project in order for the JUnit tests
  11. to work. To do this:
  12. - Right-click on your project
  13. - Select Build Path --> add libraries
  14. - Select JUnit
  15. - Click next
  16. - Click finish.
  17.  
  18. How to generate Javadocs:
  19. =========================
  20. - Select the project containing your prac code
  21. - Click "Project" in the menu bar
  22. - Select "Generate Javadoc"
  23. - You *may* need to tell it where to find the executable that generates the javadoc.
  24. - Click configure
  25. - Navigate to Program Files, find the JDK, go to `bin`. There should be a `javadoc.exe` somewhere.
  26. - follow instrusctions on pop-up dialogue.
  27.  
  28. - If you left everything as default in the pop=up, you should get a folder called `doc`
  29. in your project. The `doc` folder will contain a folder called `week4` or whatever else
  30. you called your package. Double-click on the HTML file to view the javadoc.
  31.  
  32. How to run JUnit tests:
  33. =======================
  34. -- Select your project
  35. -- Go to the little green play button on the menu bar and press the downwards-pointing arrow
  36. next to it, then choose JUnit test. Alternatively, do Alt+Shift+X then press T
  37.  
  38. Hints for implementing checkInv():
  39. ==================================
  40. -- The invariants are written in a comment at the top of the class.
  41. For ease of reference, copy them into the checkInv() method.
  42. -- What does the ArrayList `terms` store?
  43. -- Read the documentation for Term. How do you access the coefficient and exponent?
  44. -- For checking whether there are repeated exponents:
  45. - As with everything, there are multiple ways to do this. For one way,
  46. google the Javadoc for `Set` and see what the class does.
  47.  
  48. Exiting debug mode:
  49. ===================
  50. -- To go back to your code from the debug view, click the `Java` button at the top right hand side,
  51. next to `Debug`.
  52.  
  53. Hints for implementing the subtract method:
  54. ===========================================
  55. -- What exactly does it mean to subtract something? You can think of 3 - 5 as 3 + (-5), right?
  56. -- There is a method called `subtract()` in the Term class.
  57. -- There is also a method called `negate()` which returns the negative of a term.
  58. i.e., if the original term is 3x it will return a new term -3x.
  59.  
  60. Writing JUnit tests for the Lamp class:
  61. =========================================
  62. -- This is a simple class so the tests are going to simple; don't overthink it!
  63. -- Basically, all you want to do is to make sure that the state of the lamp is always correct.
  64. -- You want to test the initial state of the lamp - what state should it be in
  65. when you construct it? I.e., should it be OFF, LOW, MED or HIGH?
  66. -- Then you want to make sure that any method that changes the state of the lamp (i.e.,
  67. changes whether or not it's OFF, LOW, etc.) changes the state correctly. You should
  68. test all possible state transitions.
  69. -- Remember to import the `Assert` class from JUnit.
  70.  
  71. Miscellaneous:
  72. ======================
  73. -- Do not make any assumptions about where a bug is. For instance, if you wrote the checkInv()
  74. function incorrectly, then your tests will fail even if Polynomial's add() method is correct.
  75. If you are convinced that you tracked down the bug, make sure your checkInv() is correct!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement