Seth 6 vuotta sitten
vanhempi
commit
ca56de5ef1
3 muutettua tiedostoa jossa 102 lisäystä ja 68 poistoa
  1. 69
    67
      .idea/workspace.xml
  2. 4
    0
      arraz/src/main/java/Arraz.java
  3. 29
    1
      arraz/src/test/java/ArrazTest.java

+ 69
- 67
.idea/workspace.xml Näytä tiedosto

@@ -22,7 +22,7 @@
22 22
       </usages-collector>
23 23
       <usages-collector id="statistics.file.types.edit">
24 24
         <counts>
25
-          <entry key="JAVA" value="8890" />
25
+          <entry key="JAVA" value="9498" />
26 26
           <entry key="XML" value="3" />
27 27
         </counts>
28 28
       </usages-collector>
@@ -37,11 +37,11 @@
37 37
   </component>
38 38
   <component name="FileEditorManager">
39 39
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
40
-      <file pinned="false" current-in-tab="true">
40
+      <file pinned="false" current-in-tab="false">
41 41
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
42 42
           <provider selected="true" editor-type-id="text-editor">
43
-            <state relative-caret-position="372">
44
-              <caret line="294" column="44" selection-start-line="294" selection-start-column="44" selection-end-line="294" selection-end-column="44" />
43
+            <state relative-caret-position="358">
44
+              <caret line="323" selection-start-line="323" selection-end-line="323" />
45 45
               <folding>
46 46
                 <element signature="imports" expanded="true" />
47 47
                 <element signature="e#4388#4389#0" expanded="true" />
@@ -54,8 +54,8 @@
54 54
       <file pinned="false" current-in-tab="false">
55 55
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
56 56
           <provider selected="true" editor-type-id="text-editor">
57
-            <state relative-caret-position="388">
58
-              <caret line="140" lean-forward="true" selection-start-line="140" selection-end-line="140" />
57
+            <state relative-caret-position="319">
58
+              <caret line="141" column="45" selection-start-line="141" selection-start-column="45" selection-end-line="141" selection-end-column="45" />
59 59
               <folding>
60 60
                 <element signature="e#3351#3352#0" expanded="true" />
61 61
                 <element signature="e#3376#3377#0" expanded="true" />
@@ -63,12 +63,14 @@
63 63
                 <element signature="e#3482#3483#0" expanded="true" />
64 64
                 <element signature="e#3556#3557#0" expanded="true" />
65 65
                 <element signature="e#3603#3604#0" expanded="true" />
66
+                <element signature="e#3677#3678#0" expanded="true" />
67
+                <element signature="e#3714#3715#0" expanded="true" />
66 68
               </folding>
67 69
             </state>
68 70
           </provider>
69 71
         </entry>
70 72
       </file>
71
-      <file pinned="false" current-in-tab="false">
73
+      <file pinned="false" current-in-tab="true">
72 74
         <entry file="file://$PROJECT_DIR$/README.md">
73 75
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
74 76
             <state split_layout="SPLIT">
@@ -127,8 +129,8 @@
127 129
         <option value="$PROJECT_DIR$/arraz/pom.xml" />
128 130
         <option value="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" />
129 131
         <option value="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" />
130
-        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
131 132
         <option value="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" />
133
+        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
132 134
       </list>
133 135
     </option>
134 136
   </component>
@@ -213,7 +215,7 @@
213 215
     <property name="GO_FMT" value="false" />
214 216
     <property name="WebServerToolWindowFactoryState" value="false" />
215 217
     <property name="aspect.path.notification.shown" value="true" />
216
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544190595334" />
218
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544192715898" />
217 219
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
218 220
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
219 221
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -243,7 +245,7 @@
243 245
       </list>
244 246
     </option>
245 247
   </component>
246
-  <component name="RunManager" selected="JUnit.ArrazTest.testMakeMeAnArrayListFromArray2">
248
+  <component name="RunManager" selected="JUnit.ArrazTest.testCheck2ArraysForEqual2">
247 249
     <configuration default="true" type="Applet" factoryName="Applet">
248 250
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
249 251
       <method v="2">
@@ -256,55 +258,53 @@
256 258
         <option name="Make" enabled="true" />
257 259
       </method>
258 260
     </configuration>
259
-    <configuration name="ArrazTest.testMakeMeAnArrayFromArrayList1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
261
+    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
260 262
       <module name="arraz" />
261 263
       <option name="PACKAGE_NAME" value="" />
262 264
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
263
-      <option name="METHOD_NAME" value="testMakeMeAnArrayFromArrayList1" />
264
-      <option name="TEST_OBJECT" value="method" />
265 265
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
266 266
       <method v="2">
267 267
         <option name="Make" enabled="true" />
268 268
       </method>
269 269
     </configuration>
270
-    <configuration name="ArrazTest.testMakeMeAnArrayListFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
270
+    <configuration name="ArrazTest.testCheck2ArraysForEqual1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
271 271
       <module name="arraz" />
272 272
       <option name="PACKAGE_NAME" value="" />
273 273
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
274
-      <option name="METHOD_NAME" value="testMakeMeAnArrayListFromArray1" />
274
+      <option name="METHOD_NAME" value="testCheck2ArraysForEqual1" />
275 275
       <option name="TEST_OBJECT" value="method" />
276 276
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
277 277
       <method v="2">
278 278
         <option name="Make" enabled="true" />
279 279
       </method>
280 280
     </configuration>
281
-    <configuration name="ArrazTest.testMakeMeAnArrayListFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
281
+    <configuration name="ArrazTest.testCheck2ArraysForEqual2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
282 282
       <module name="arraz" />
283 283
       <option name="PACKAGE_NAME" value="" />
284 284
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
285
-      <option name="METHOD_NAME" value="testMakeMeAnArrayListFromArray2" />
285
+      <option name="METHOD_NAME" value="testCheck2ArraysForEqual2" />
286 286
       <option name="TEST_OBJECT" value="method" />
287 287
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
288 288
       <method v="2">
289 289
         <option name="Make" enabled="true" />
290 290
       </method>
291 291
     </configuration>
292
-    <configuration name="ArrazTest.testRemoveDupesFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
292
+    <configuration name="ArrazTest.testMakeMeAnArrayFromArrayList2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
293 293
       <module name="arraz" />
294 294
       <option name="PACKAGE_NAME" value="" />
295 295
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
296
-      <option name="METHOD_NAME" value="testRemoveDupesFromArray1" />
296
+      <option name="METHOD_NAME" value="testMakeMeAnArrayFromArrayList2" />
297 297
       <option name="TEST_OBJECT" value="method" />
298 298
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
299 299
       <method v="2">
300 300
         <option name="Make" enabled="true" />
301 301
       </method>
302 302
     </configuration>
303
-    <configuration name="ArrazTest.testRemoveDupesFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
303
+    <configuration name="ArrazTest.testMakeMeAnArrayListFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
304 304
       <module name="arraz" />
305 305
       <option name="PACKAGE_NAME" value="" />
306 306
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
307
-      <option name="METHOD_NAME" value="testRemoveDupesFromArray2" />
307
+      <option name="METHOD_NAME" value="testMakeMeAnArrayListFromArray2" />
308 308
       <option name="TEST_OBJECT" value="method" />
309 309
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
310 310
       <method v="2">
@@ -335,19 +335,19 @@
335 335
       </method>
336 336
     </configuration>
337 337
     <list>
338
-      <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray2" />
339
-      <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray1" />
340
-      <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayListFromArray1" />
341 338
       <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayListFromArray2" />
342
-      <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayFromArrayList1" />
339
+      <item itemvalue="JUnit.ArrazTest" />
340
+      <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayFromArrayList2" />
341
+      <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual1" />
342
+      <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual2" />
343 343
     </list>
344 344
     <recent_temporary>
345 345
       <list>
346
+        <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual2" />
347
+        <item itemvalue="JUnit.ArrazTest.testCheck2ArraysForEqual1" />
348
+        <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayFromArrayList2" />
349
+        <item itemvalue="JUnit.ArrazTest" />
346 350
         <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayListFromArray2" />
347
-        <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayFromArrayList1" />
348
-        <item itemvalue="JUnit.ArrazTest.testMakeMeAnArrayListFromArray1" />
349
-        <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray2" />
350
-        <item itemvalue="JUnit.ArrazTest.testRemoveDupesFromArray1" />
351 351
       </list>
352 352
     </recent_temporary>
353 353
   </component>
@@ -364,7 +364,7 @@
364 364
       <workItem from="1543955862749" duration="2347000" />
365 365
       <workItem from="1543958998826" duration="113000" />
366 366
       <workItem from="1544020724645" duration="762000" />
367
-      <workItem from="1544046933389" duration="24417000" />
367
+      <workItem from="1544046933389" duration="26304000" />
368 368
     </task>
369 369
     <task id="LOCAL-00001" summary="readme and docs">
370 370
       <created>1544021313039</created>
@@ -377,24 +377,6 @@
377 377
     <servers />
378 378
   </component>
379 379
   <component name="TestHistory">
380
-    <history-entry file="ArrazTest_testRemoveDupesFromArray2 - 2018.12.06 at 18h 34m 13s.xml">
381
-      <configuration name="ArrazTest.testRemoveDupesFromArray2" configurationId="JUnit" />
382
-    </history-entry>
383
-    <history-entry file="ArrazTest_testRemoveDupesFromArray2 - 2018.12.06 at 18h 35m 05s.xml">
384
-      <configuration name="ArrazTest.testRemoveDupesFromArray2" configurationId="JUnit" />
385
-    </history-entry>
386
-    <history-entry file="ArrazTest_testRemoveDupesFromArray2 - 2018.12.07 at 07h 58m 33s.xml">
387
-      <configuration name="ArrazTest.testRemoveDupesFromArray2" configurationId="JUnit" />
388
-    </history-entry>
389
-    <history-entry file="ArrazTest_testRemoveDupesFromArray2 - 2018.12.07 at 08h 12m 08s.xml">
390
-      <configuration name="ArrazTest.testRemoveDupesFromArray2" configurationId="JUnit" />
391
-    </history-entry>
392
-    <history-entry file="ArrazTest_testRemoveDupesFromArray1 - 2018.12.07 at 08h 12m 26s.xml">
393
-      <configuration name="ArrazTest.testRemoveDupesFromArray1" configurationId="JUnit" />
394
-    </history-entry>
395
-    <history-entry file="ArrazTest_testRemoveDupesFromArray2 - 2018.12.07 at 08h 15m 25s.xml">
396
-      <configuration name="ArrazTest.testRemoveDupesFromArray2" configurationId="JUnit" />
397
-    </history-entry>
398 380
     <history-entry file="ArrazTest_testRemoveDupesFromArray1 - 2018.12.07 at 08h 15m 32s.xml">
399 381
       <configuration name="ArrazTest.testRemoveDupesFromArray1" configurationId="JUnit" />
400 382
     </history-entry>
@@ -407,9 +389,27 @@
407 389
     <history-entry file="ArrazTest_testMakeMeAnArrayListFromArray2 - 2018.12.07 at 08h 40m 23s.xml">
408 390
       <configuration name="ArrazTest.testMakeMeAnArrayListFromArray2" configurationId="JUnit" />
409 391
     </history-entry>
392
+    <history-entry file="ArrazTest_testMakeMeAnArrayFromArrayList1 - 2018.12.07 at 08h 49m 53s.xml">
393
+      <configuration name="ArrazTest.testMakeMeAnArrayFromArrayList1" configurationId="JUnit" />
394
+    </history-entry>
395
+    <history-entry file="ArrazTest_testMakeMeAnArrayListFromArray2 - 2018.12.07 at 08h 49m 56s.xml">
396
+      <configuration name="ArrazTest.testMakeMeAnArrayListFromArray2" configurationId="JUnit" />
397
+    </history-entry>
398
+    <history-entry file="ArrazTest - 2018.12.07 at 09h 00m 04s.xml">
399
+      <configuration name="ArrazTest" configurationId="JUnit" />
400
+    </history-entry>
401
+    <history-entry file="ArrazTest_testMakeMeAnArrayFromArrayList2 - 2018.12.07 at 09h 11m 27s.xml">
402
+      <configuration name="ArrazTest.testMakeMeAnArrayFromArrayList2" configurationId="JUnit" />
403
+    </history-entry>
404
+    <history-entry file="ArrazTest_testCheck2ArraysForEqual1 - 2018.12.07 at 09h 13m 25s.xml">
405
+      <configuration name="ArrazTest.testCheck2ArraysForEqual1" configurationId="JUnit" />
406
+    </history-entry>
407
+    <history-entry file="ArrazTest_testCheck2ArraysForEqual2 - 2018.12.07 at 09h 13m 27s.xml">
408
+      <configuration name="ArrazTest.testCheck2ArraysForEqual2" configurationId="JUnit" />
409
+    </history-entry>
410 410
   </component>
411 411
   <component name="TimeTrackingManager">
412
-    <option name="totallyTimeSpent" value="27639000" />
412
+    <option name="totallyTimeSpent" value="29526000" />
413 413
   </component>
414 414
   <component name="ToolWindowManager">
415 415
     <frame x="1" y="23" width="1440" height="807" extended-state="0" />
@@ -507,20 +507,22 @@
507 507
         </state>
508 508
       </provider>
509 509
     </entry>
510
-    <entry file="file://$PROJECT_DIR$/README.md">
511
-      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
512
-        <state split_layout="SPLIT">
513
-          <first_editor relative-caret-position="306">
514
-            <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
515
-          </first_editor>
516
-          <second_editor />
510
+    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
511
+      <provider selected="true" editor-type-id="text-editor">
512
+        <state relative-caret-position="358">
513
+          <caret line="323" selection-start-line="323" selection-end-line="323" />
514
+          <folding>
515
+            <element signature="imports" expanded="true" />
516
+            <element signature="e#4388#4389#0" expanded="true" />
517
+            <element signature="e#4411#4412#0" expanded="true" />
518
+          </folding>
517 519
         </state>
518 520
       </provider>
519 521
     </entry>
520 522
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
521 523
       <provider selected="true" editor-type-id="text-editor">
522
-        <state relative-caret-position="388">
523
-          <caret line="140" lean-forward="true" selection-start-line="140" selection-end-line="140" />
524
+        <state relative-caret-position="319">
525
+          <caret line="141" column="45" selection-start-line="141" selection-start-column="45" selection-end-line="141" selection-end-column="45" />
524 526
           <folding>
525 527
             <element signature="e#3351#3352#0" expanded="true" />
526 528
             <element signature="e#3376#3377#0" expanded="true" />
@@ -528,19 +530,19 @@
528 530
             <element signature="e#3482#3483#0" expanded="true" />
529 531
             <element signature="e#3556#3557#0" expanded="true" />
530 532
             <element signature="e#3603#3604#0" expanded="true" />
533
+            <element signature="e#3677#3678#0" expanded="true" />
534
+            <element signature="e#3714#3715#0" expanded="true" />
531 535
           </folding>
532 536
         </state>
533 537
       </provider>
534 538
     </entry>
535
-    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
536
-      <provider selected="true" editor-type-id="text-editor">
537
-        <state relative-caret-position="372">
538
-          <caret line="294" column="44" selection-start-line="294" selection-start-column="44" selection-end-line="294" selection-end-column="44" />
539
-          <folding>
540
-            <element signature="imports" expanded="true" />
541
-            <element signature="e#4388#4389#0" expanded="true" />
542
-            <element signature="e#4411#4412#0" expanded="true" />
543
-          </folding>
539
+    <entry file="file://$PROJECT_DIR$/README.md">
540
+      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
541
+        <state split_layout="SPLIT">
542
+          <first_editor relative-caret-position="306">
543
+            <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
544
+          </first_editor>
545
+          <second_editor />
544 546
         </state>
545 547
       </provider>
546 548
     </entry>

+ 4
- 0
arraz/src/main/java/Arraz.java Näytä tiedosto

@@ -137,4 +137,8 @@ public class Arraz {
137 137
     public Integer[] makeMeAnArrayFromArrayList(List<Integer> list){
138 138
         return list.toArray(new Integer[0]);
139 139
     }
140
+
141
+    public boolean check2ArraysForEqual(int[] array1, int[] array2){
142
+        return Arrays.equals(array1, array2);
143
+    }
140 144
 }

+ 29
- 1
arraz/src/test/java/ArrazTest.java Näytä tiedosto

@@ -292,6 +292,34 @@ public class ArrazTest {
292 292
         list.add(50);
293 293
         Integer[] actual = testArraz.makeMeAnArrayFromArrayList(list);
294 294
 
295
-        Assert.assertEquals(expected, actual);
295
+        Assert.assertArrayEquals(expected, actual);
296
+    }
297
+
298
+    @Test
299
+    public void testMakeMeAnArrayFromArrayList2(){
300
+        Integer[] expected = new Integer[]{43, 19, 99, 6};
301
+        List<Integer> list = new ArrayList<>();
302
+        list.add(43);
303
+        list.add(19);
304
+        list.add(99);
305
+        list.add(6);
306
+        Integer[] actual = testArraz.makeMeAnArrayFromArrayList(list);
307
+
308
+        Assert.assertArrayEquals(expected, actual);
296 309
     }
310
+
311
+
312
+    @Test
313
+    public void testCheck2ArraysForEqual1(){
314
+        int[] expected = new int[]{5, 10, 3, 29, 100};
315
+        Assert.assertTrue(testArraz.check2ArraysForEqual(arr1, expected));
316
+    }
317
+
318
+    @Test
319
+    public void testCheck2ArraysForEqual2(){
320
+        int[] expected = new int[]{100, 900, 1, 32};
321
+        Assert.assertFalse(testArraz.check2ArraysForEqual(arr1, expected));
322
+    }
323
+
324
+
297 325
 }