lots of exercises in java... from https://github.com/exercism/java

HexadecimalTest.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import org.junit.Test;
  2. import org.junit.Ignore;
  3. import static org.junit.Assert.assertEquals;
  4. public class HexadecimalTest {
  5. @Test
  6. public void testOne(){
  7. int expected = 1;
  8. assertEquals(expected, Hexadecimal.toDecimal("1"));
  9. }
  10. @Ignore
  11. @Test
  12. public void testC(){
  13. int expected = 12;
  14. assertEquals(expected, Hexadecimal.toDecimal("c"));
  15. }
  16. @Ignore
  17. @Test
  18. public void test10(){
  19. int expected = 16;
  20. assertEquals(expected, Hexadecimal.toDecimal("10"));
  21. }
  22. @Ignore
  23. @Test
  24. public void testAf(){
  25. int expected = 175;
  26. assertEquals(expected, Hexadecimal.toDecimal("af"));
  27. }
  28. @Ignore
  29. @Test
  30. public void test100(){
  31. int expected = 256;
  32. assertEquals(expected, Hexadecimal.toDecimal("100"));
  33. }
  34. @Ignore
  35. @Test
  36. public void test19ace(){
  37. int expected = 105166;
  38. assertEquals(expected, Hexadecimal.toDecimal("19ace"));
  39. }
  40. @Ignore
  41. @Test
  42. public void testInvalid(){
  43. int expected = 0;
  44. assertEquals(expected, Hexadecimal.toDecimal("carrot"));
  45. }
  46. @Ignore
  47. @Test
  48. public void testBlack(){
  49. int expected = 0;
  50. assertEquals(expected, Hexadecimal.toDecimal("000000"));
  51. }
  52. @Ignore
  53. @Test
  54. public void testWhite(){
  55. int expected = 16777215;
  56. assertEquals(expected, Hexadecimal.toDecimal("ffffff"));
  57. }
  58. @Ignore
  59. @Test
  60. public void testYellow(){
  61. int expected = 16776960;
  62. assertEquals(expected, Hexadecimal.toDecimal("ffff00"));
  63. }
  64. }