Alfredo Castillo 6 lat temu
rodzic
commit
c2b4338627
2 zmienionych plików z 162 dodań i 37 usunięć
  1. 102
    0
      ScrabbleTest.java
  2. 60
    37
      package.bluej

+ 102
- 0
ScrabbleTest.java Wyświetl plik

@@ -0,0 +1,102 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class ScrabbleTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class ScrabbleTest
15
+{
16
+    @Test
17
+    public void ScrabbleTest(){
18
+
19
+    //expected
20
+    int expected = 5;
21
+    
22
+    //actaul
23
+    int actual = Scrabble.score("gato");
24
+    
25
+    assertEquals(expected, actual);
26
+    }
27
+    
28
+    @Test 
29
+    public void ScrabbleTest2(){
30
+    int expected = 8;
31
+    
32
+    int actual = Scrabble.score("house");
33
+    
34
+    assertEquals(expected, actual);
35
+    
36
+    }
37
+    
38
+    @Test
39
+    public void ScrabbleTest3(){
40
+    int expected = 22;
41
+    
42
+    int actual = Scrabble.score("quiz");
43
+    
44
+    assertEquals(expected, actual);
45
+    }
46
+    
47
+    @Test
48
+    public void ScrabbleTest4(){
49
+    int expected = 13;
50
+    
51
+    int actual = Scrabble.score("yugioh");
52
+    
53
+    assertEquals(expected, actual);
54
+    }
55
+    
56
+    @Test 
57
+    public void ScrabbleTest5(){
58
+    int expected = 5;
59
+    
60
+    int actual = Scrabble.score("ps4");
61
+    
62
+    assertEquals(expected, actual);
63
+    }
64
+    
65
+    @Test
66
+    public void ScrabbleTest6(){
67
+    int expected = 11;
68
+    
69
+    int actual = Scrabble.score("iphone");
70
+    
71
+    assertEquals(expected, actual);
72
+    }
73
+    
74
+    @Test
75
+    public void ScrabbleTest7(){
76
+    int expected = 10;
77
+    
78
+    int actual = Scrabble.score("samsung");
79
+    
80
+    assertEquals(expected, actual);
81
+    }
82
+    
83
+    @Test
84
+    public void ScrabbleTest8(){
85
+    int expected = 23;
86
+    
87
+    int actual = Scrabble.score("philosophy");
88
+    
89
+    assertEquals(expected, actual);
90
+    
91
+    }
92
+    
93
+    @Test
94
+    public void ScrableTest9(){
95
+    int expected = 23;
96
+    
97
+    int actual = Scrabble.score("quadrilateral");
98
+    
99
+    assertEquals(expected, actual);
100
+    }
101
+   
102
+}

+ 60
- 37
package.bluej Wyświetl plik

@@ -1,26 +1,41 @@
1 1
 #BlueJ package file
2
-dependency1.from=Account
3
-dependency1.to=AccountException
2
+dependency1.from=Calendar1
3
+dependency1.to=CalendarGraphic
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=DepositAccount
6
-dependency2.to=AccountException
5
+dependency2.from=Calendar1
6
+dependency2.to=DateException
7 7
 dependency2.type=UsesDependency
8
-editor.fx.0.height=722
9
-editor.fx.0.width=800
10
-editor.fx.0.x=114
11
-editor.fx.0.y=175
8
+dependency3.from=Account
9
+dependency3.to=AccountException
10
+dependency3.type=UsesDependency
11
+dependency4.from=Calendar
12
+dependency4.to=DateException
13
+dependency4.type=UsesDependency
14
+dependency5.from=Date
15
+dependency5.to=DateException
16
+dependency5.type=UsesDependency
17
+dependency6.from=DepositAccount
18
+dependency6.to=AccountException
19
+dependency6.type=UsesDependency
20
+dependency7.from=ScrabbleTest
21
+dependency7.to=Scrabble
22
+dependency7.type=UsesDependency
23
+editor.fx.0.height=654
24
+editor.fx.0.width=1116
25
+editor.fx.0.x=66
26
+editor.fx.0.y=181
12 27
 objectbench.height=101
13 28
 objectbench.width=461
14 29
 package.divider.horizontal=0.6
15 30
 package.divider.vertical=0.8007380073800738
16 31
 package.editor.height=427
17 32
 package.editor.width=674
18
-package.editor.x=1006
19
-package.editor.y=133
33
+package.editor.x=44
34
+package.editor.y=130
20 35
 package.frame.height=600
21 36
 package.frame.width=800
22
-package.numDependencies=2
23
-package.numTargets=13
37
+package.numDependencies=7
38
+package.numTargets=14
24 39
 package.showExtends=true
25 40
 package.showUses=true
26 41
 project.charset=UTF-8
@@ -36,6 +51,7 @@ target1.type=ClassTarget
36 51
 target1.width=130
37 52
 target1.x=450
38 53
 target1.y=190
54
+target10.association=ScrabbleTest
39 55
 target10.height=50
40 56
 target10.name=Scrabble
41 57
 target10.showInterface=false
@@ -44,40 +60,47 @@ target10.width=80
44 60
 target10.x=10
45 61
 target10.y=250
46 62
 target11.height=50
47
-target11.name=TriangleTwo
63
+target11.name=DepositAccount
48 64
 target11.showInterface=false
49 65
 target11.type=ClassTarget
50
-target11.width=100
51
-target11.x=120
52
-target11.y=310
66
+target11.width=120
67
+target11.x=170
68
+target11.y=120
53 69
 target12.height=50
54
-target12.name=AccountException
70
+target12.name=TriangleTwo
55 71
 target12.showInterface=false
56 72
 target12.type=ClassTarget
57
-target12.width=140
58
-target12.x=190
59
-target12.y=30
73
+target12.width=100
74
+target12.x=120
75
+target12.y=310
60 76
 target13.height=50
61
-target13.name=DateException
77
+target13.name=AccountException
62 78
 target13.showInterface=false
63 79
 target13.type=ClassTarget
64
-target13.width=120
65
-target13.x=470
66
-target13.y=340
80
+target13.width=140
81
+target13.x=190
82
+target13.y=30
83
+target14.height=50
84
+target14.name=DateException
85
+target14.showInterface=false
86
+target14.type=ClassTarget
87
+target14.width=120
88
+target14.x=470
89
+target14.y=340
67 90
 target2.height=50
68
-target2.name=Account
91
+target2.name=Calendar1
69 92
 target2.showInterface=false
70 93
 target2.type=ClassTarget
71
-target2.width=80
72
-target2.x=50
73
-target2.y=110
94
+target2.width=90
95
+target2.x=330
96
+target2.y=220
74 97
 target3.height=50
75
-target3.name=Calendar1
98
+target3.name=Account
76 99
 target3.showInterface=false
77 100
 target3.type=ClassTarget
78
-target3.width=90
79
-target3.x=330
80
-target3.y=220
101
+target3.width=80
102
+target3.x=50
103
+target3.y=110
81 104
 target4.height=50
82 105
 target4.name=Squares
83 106
 target4.showInterface=false
@@ -114,9 +137,9 @@ target8.width=80
114 137
 target8.x=350
115 138
 target8.y=290
116 139
 target9.height=50
117
-target9.name=DepositAccount
140
+target9.name=ScrabbleTest
118 141
 target9.showInterface=false
119
-target9.type=ClassTarget
120
-target9.width=120
121
-target9.x=170
122
-target9.y=120
142
+target9.type=UnitTestTargetJunit4
143
+target9.width=80
144
+target9.x=40
145
+target9.y=220