Seth 6 vuotta sitten
vanhempi
commit
829f794f7d
3 muutettua tiedostoa jossa 229 lisäystä ja 66 poistoa
  1. 95
    57
      .idea/workspace.xml
  2. 32
    4
      arraz/src/main/java/Arraz.java
  3. 102
    5
      arraz/src/test/java/ArrazTest.java

+ 95
- 57
.idea/workspace.xml Näytä tiedosto

@@ -22,14 +22,14 @@
22 22
       </usages-collector>
23 23
       <usages-collector id="statistics.file.types.edit">
24 24
         <counts>
25
-          <entry key="JAVA" value="11571" />
25
+          <entry key="JAVA" value="14150" />
26 26
           <entry key="XML" value="3" />
27 27
         </counts>
28 28
       </usages-collector>
29 29
       <usages-collector id="statistics.file.types.open">
30 30
         <counts>
31 31
           <entry key="CLASS" value="1" />
32
-          <entry key="JAVA" value="5" />
32
+          <entry key="JAVA" value="6" />
33 33
           <entry key="XML" value="3" />
34 34
         </counts>
35 35
       </usages-collector>
@@ -40,8 +40,8 @@
40 40
       <file pinned="false" current-in-tab="false">
41 41
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
42 42
           <provider selected="true" editor-type-id="text-editor">
43
-            <state relative-caret-position="556">
44
-              <caret line="170" column="21" selection-start-line="170" selection-start-column="21" selection-end-line="170" selection-end-column="21" />
43
+            <state relative-caret-position="300">
44
+              <caret line="198" column="41" selection-start-line="198" selection-start-column="41" selection-end-line="198" selection-end-column="41" />
45 45
               <folding>
46 46
                 <element signature="e#3440#3441#0" expanded="true" />
47 47
                 <element signature="e#3482#3483#0" expanded="true" />
@@ -49,6 +49,14 @@
49 49
                 <element signature="e#3603#3604#0" expanded="true" />
50 50
                 <element signature="e#3677#3678#0" expanded="true" />
51 51
                 <element signature="e#3714#3715#0" expanded="true" />
52
+                <element signature="e#4954#4955#0" expanded="true" />
53
+                <element signature="e#4995#4996#0" expanded="true" />
54
+                <element signature="e#5042#5043#0" expanded="true" />
55
+                <element signature="e#5115#5116#0" expanded="true" />
56
+                <element signature="e#5173#5174#0" expanded="true" />
57
+                <element signature="e#5234#5235#0" expanded="true" />
58
+                <element signature="e#5305#5306#0" expanded="true" />
59
+                <element signature="e#5342#5343#0" expanded="true" />
52 60
               </folding>
53 61
             </state>
54 62
           </provider>
@@ -57,8 +65,8 @@
57 65
       <file pinned="false" current-in-tab="true">
58 66
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
59 67
           <provider selected="true" editor-type-id="text-editor">
60
-            <state relative-caret-position="533">
61
-              <caret line="363" column="63" selection-start-line="363" selection-start-column="63" selection-end-line="363" selection-end-column="63" />
68
+            <state relative-caret-position="300">
69
+              <caret line="462" column="5" lean-forward="true" selection-start-line="462" selection-start-column="5" selection-end-line="462" selection-end-column="5" />
62 70
               <folding>
63 71
                 <element signature="imports" expanded="true" />
64 72
               </folding>
@@ -105,7 +113,10 @@
105 113
   </component>
106 114
   <component name="FindInProjectRecents">
107 115
     <findStrings>
116
+      <find>list</find>
117
+      <find>rev</find>
108 118
       <find>sort</find>
119
+      <find>rever</find>
109 120
     </findStrings>
110 121
   </component>
111 122
   <component name="Git.Settings">
@@ -219,7 +230,7 @@
219 230
     <property name="GO_FMT" value="false" />
220 231
     <property name="WebServerToolWindowFactoryState" value="false" />
221 232
     <property name="aspect.path.notification.shown" value="true" />
222
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544206709239" />
233
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544219473137" />
223 234
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
224 235
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
225 236
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -249,7 +260,7 @@
249 260
       </list>
250 261
     </option>
251 262
   </component>
252
-  <component name="RunManager" selected="JUnit.ArrazTest.testTheTotalOfTenIs302">
263
+  <component name="RunManager" selected="JUnit.ArrazTest.testInsertEndCopy1">
253 264
     <configuration default="true" type="Applet" factoryName="Applet">
254 265
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
255 266
       <method v="2">
@@ -262,55 +273,53 @@
262 273
         <option name="Make" enabled="true" />
263 274
       </method>
264 275
     </configuration>
265
-    <configuration name="ArrazTest.testArrayHas65and772" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
276
+    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
266 277
       <module name="arraz" />
267 278
       <option name="PACKAGE_NAME" value="" />
268 279
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
269
-      <option name="METHOD_NAME" value="testArrayHas65and772" />
270
-      <option name="TEST_OBJECT" value="method" />
271 280
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
272 281
       <method v="2">
273 282
         <option name="Make" enabled="true" />
274 283
       </method>
275 284
     </configuration>
276
-    <configuration name="ArrazTest.testFind2ndLargestFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
285
+    <configuration name="ArrazTest.testInsertEndCopy1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
277 286
       <module name="arraz" />
278 287
       <option name="PACKAGE_NAME" value="" />
279 288
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
280
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray1" />
289
+      <option name="METHOD_NAME" value="testInsertEndCopy1" />
281 290
       <option name="TEST_OBJECT" value="method" />
282 291
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
283 292
       <method v="2">
284 293
         <option name="Make" enabled="true" />
285 294
       </method>
286 295
     </configuration>
287
-    <configuration name="ArrazTest.testFind2ndLargestFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
296
+    <configuration name="ArrazTest.testInsertEndCopy2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
288 297
       <module name="arraz" />
289 298
       <option name="PACKAGE_NAME" value="" />
290 299
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
291
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray2" />
300
+      <option name="METHOD_NAME" value="testInsertEndCopy2" />
292 301
       <option name="TEST_OBJECT" value="method" />
293 302
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
294 303
       <method v="2">
295 304
         <option name="Make" enabled="true" />
296 305
       </method>
297 306
     </configuration>
298
-    <configuration name="ArrazTest.testTheTotalOfTenIs301" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
307
+    <configuration name="ArrazTest.testInsertStartCopy1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299 308
       <module name="arraz" />
300 309
       <option name="PACKAGE_NAME" value="" />
301 310
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
302
-      <option name="METHOD_NAME" value="testTheTotalOfTenIs301" />
311
+      <option name="METHOD_NAME" value="testInsertStartCopy1" />
303 312
       <option name="TEST_OBJECT" value="method" />
304 313
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
305 314
       <method v="2">
306 315
         <option name="Make" enabled="true" />
307 316
       </method>
308 317
     </configuration>
309
-    <configuration name="ArrazTest.testTheTotalOfTenIs302" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
318
+    <configuration name="ArrazTest.testInsertStartCopy2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
310 319
       <module name="arraz" />
311 320
       <option name="PACKAGE_NAME" value="" />
312 321
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
313
-      <option name="METHOD_NAME" value="testTheTotalOfTenIs302" />
322
+      <option name="METHOD_NAME" value="testInsertStartCopy2" />
314 323
       <option name="TEST_OBJECT" value="method" />
315 324
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
316 325
       <method v="2">
@@ -341,19 +350,19 @@
341 350
       </method>
342 351
     </configuration>
343 352
     <list>
344
-      <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
345
-      <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
346
-      <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
347
-      <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs301" />
348
-      <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs302" />
353
+      <item itemvalue="JUnit.ArrazTest" />
354
+      <item itemvalue="JUnit.ArrazTest.testInsertStartCopy1" />
355
+      <item itemvalue="JUnit.ArrazTest.testInsertStartCopy2" />
356
+      <item itemvalue="JUnit.ArrazTest.testInsertEndCopy2" />
357
+      <item itemvalue="JUnit.ArrazTest.testInsertEndCopy1" />
349 358
     </list>
350 359
     <recent_temporary>
351 360
       <list>
352
-        <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs302" />
353
-        <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs301" />
354
-        <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
355
-        <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
356
-        <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
361
+        <item itemvalue="JUnit.ArrazTest.testInsertEndCopy1" />
362
+        <item itemvalue="JUnit.ArrazTest.testInsertEndCopy2" />
363
+        <item itemvalue="JUnit.ArrazTest.testInsertStartCopy2" />
364
+        <item itemvalue="JUnit.ArrazTest.testInsertStartCopy1" />
365
+        <item itemvalue="JUnit.ArrazTest" />
357 366
       </list>
358 367
     </recent_temporary>
359 368
   </component>
@@ -370,7 +379,7 @@
370 379
       <workItem from="1543955862749" duration="2347000" />
371 380
       <workItem from="1543958998826" duration="113000" />
372 381
       <workItem from="1544020724645" duration="762000" />
373
-      <workItem from="1544046933389" duration="36119000" />
382
+      <workItem from="1544046933389" duration="44493000" />
374 383
     </task>
375 384
     <task id="LOCAL-00001" summary="readme and docs">
376 385
       <created>1544021313039</created>
@@ -383,45 +392,45 @@
383 392
     <servers />
384 393
   </component>
385 394
   <component name="TestHistory">
386
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin2 - 2018.12.07 at 12h 43m 07s.xml">
387
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin2" configurationId="JUnit" />
388
-    </history-entry>
389
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin - 2018.12.07 at 12h 43m 51s.xml">
390
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin" configurationId="JUnit" />
395
+    <history-entry file="ArrazTest_testInsertArrayAt2 - 2018.12.07 at 16h 02m 54s.xml">
396
+      <configuration name="ArrazTest.testInsertArrayAt2" configurationId="JUnit" />
391 397
     </history-entry>
392
-    <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin - 2018.12.07 at 12h 44m 05s.xml">
393
-      <configuration name="ArrazTest.testAverageArrayWithoutMaxMin" configurationId="JUnit" />
398
+    <history-entry file="ArrazTest_testInsertArrayAt2 - 2018.12.07 at 16h 03m 30s.xml">
399
+      <configuration name="ArrazTest.testInsertArrayAt2" configurationId="JUnit" />
394 400
     </history-entry>
395
-    <history-entry file="ArrazTest_test1SumValuesOfArray1 - 2018.12.07 at 12h 46m 13s.xml">
396
-      <configuration name="ArrazTest.test1SumValuesOfArray1" configurationId="JUnit" />
401
+    <history-entry file="ArrazTest_testInsertArrayAt1 - 2018.12.07 at 16h 03m 55s.xml">
402
+      <configuration name="ArrazTest.testInsertArrayAt1" configurationId="JUnit" />
397 403
     </history-entry>
398
-    <history-entry file="ArrazTest - 2018.12.07 at 12h 46m 18s.xml">
404
+    <history-entry file="ArrazTest - 2018.12.07 at 16h 05m 27s.xml">
399 405
       <configuration name="ArrazTest" configurationId="JUnit" />
400 406
     </history-entry>
401
-    <history-entry file="ArrazTest_testArrayHas65and771 - 2018.12.07 at 12h 51m 30s.xml">
402
-      <configuration name="ArrazTest.testArrayHas65and771" configurationId="JUnit" />
407
+    <history-entry file="ArrazTest_testInsertStartCopy1 - 2018.12.07 at 16h 31m 44s.xml">
408
+      <configuration name="ArrazTest.testInsertStartCopy1" configurationId="JUnit" />
409
+    </history-entry>
410
+    <history-entry file="ArrazTest_testInsertStartCopy2 - 2018.12.07 at 16h 31m 46s.xml">
411
+      <configuration name="ArrazTest.testInsertStartCopy2" configurationId="JUnit" />
403 412
     </history-entry>
404
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 12h 51m 33s.xml">
405
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
413
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 45m 50s.xml">
414
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
406 415
     </history-entry>
407
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 12h 52m 03s.xml">
408
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
416
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 46m 24s.xml">
417
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
409 418
     </history-entry>
410
-    <history-entry file="ArrazTest_testFind2ndLargestFromArray2 - 2018.12.07 at 13h 01m 28s.xml">
411
-      <configuration name="ArrazTest.testFind2ndLargestFromArray2" configurationId="JUnit" />
419
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 46m 57s.xml">
420
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
412 421
     </history-entry>
413
-    <history-entry file="ArrazTest_testFind2ndLargestFromArray1 - 2018.12.07 at 13h 01m 31s.xml">
414
-      <configuration name="ArrazTest.testFind2ndLargestFromArray1" configurationId="JUnit" />
422
+    <history-entry file="ArrazTest_testInsertEndCopy2 - 2018.12.07 at 16h 47m 14s.xml">
423
+      <configuration name="ArrazTest.testInsertEndCopy2" configurationId="JUnit" />
415 424
     </history-entry>
416 425
   </component>
417 426
   <component name="TimeTrackingManager">
418
-    <option name="totallyTimeSpent" value="39341000" />
427
+    <option name="totallyTimeSpent" value="47715000" />
419 428
   </component>
420 429
   <component name="ToolWindowManager">
421 430
     <frame x="1" y="23" width="1440" height="807" extended-state="0" />
422 431
     <editor active="true" />
423 432
     <layout>
424
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26108727" />
433
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26108727" />
425 434
       <window_info id="Structure" order="1" weight="0.25" />
426 435
       <window_info id="Image Layers" order="2" />
427 436
       <window_info id="Designer" order="3" />
@@ -432,7 +441,7 @@
432 441
       <window_info anchor="bottom" id="Messages" weight="0.32867134" />
433 442
       <window_info anchor="bottom" id="Message" order="0" />
434 443
       <window_info anchor="bottom" id="Find" order="1" />
435
-      <window_info anchor="bottom" id="Run" order="2" weight="0.32867134" />
444
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32867134" />
436 445
       <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
437 446
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
438 447
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -491,6 +500,20 @@
491 500
     <MESSAGE value="readme and docs" />
492 501
     <option name="LAST_COMMIT_MESSAGE" value="readme and docs" />
493 502
   </component>
503
+  <component name="XDebuggerManager">
504
+    <breakpoint-manager>
505
+      <breakpoints>
506
+        <line-breakpoint enabled="true" type="java-method">
507
+          <url>file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java</url>
508
+          <line>206</line>
509
+          <properties class="ArrazTest" method="testInsertArrayAt2">
510
+            <option name="EMULATED" value="true" />
511
+          </properties>
512
+          <option name="timeStamp" value="26" />
513
+        </line-breakpoint>
514
+      </breakpoints>
515
+    </breakpoint-manager>
516
+  </component>
494 517
   <component name="editorHistoryManager">
495 518
     <entry file="file://$PROJECT_DIR$/arraz/pom.xml">
496 519
       <provider selected="true" editor-type-id="text-editor">
@@ -530,6 +553,13 @@
530 553
         </state>
531 554
       </provider>
532 555
     </entry>
556
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
557
+      <provider selected="true" editor-type-id="text-editor">
558
+        <state relative-caret-position="-10766">
559
+          <caret line="106" column="13" selection-start-line="106" selection-start-column="13" selection-end-line="106" selection-end-column="13" />
560
+        </state>
561
+      </provider>
562
+    </entry>
533 563
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
534 564
       <provider selected="true" editor-type-id="text-editor">
535 565
         <state>
@@ -555,8 +585,8 @@
555 585
     </entry>
556 586
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
557 587
       <provider selected="true" editor-type-id="text-editor">
558
-        <state relative-caret-position="556">
559
-          <caret line="170" column="21" selection-start-line="170" selection-start-column="21" selection-end-line="170" selection-end-column="21" />
588
+        <state relative-caret-position="300">
589
+          <caret line="198" column="41" selection-start-line="198" selection-start-column="41" selection-end-line="198" selection-end-column="41" />
560 590
           <folding>
561 591
             <element signature="e#3440#3441#0" expanded="true" />
562 592
             <element signature="e#3482#3483#0" expanded="true" />
@@ -564,14 +594,22 @@
564 594
             <element signature="e#3603#3604#0" expanded="true" />
565 595
             <element signature="e#3677#3678#0" expanded="true" />
566 596
             <element signature="e#3714#3715#0" expanded="true" />
597
+            <element signature="e#4954#4955#0" expanded="true" />
598
+            <element signature="e#4995#4996#0" expanded="true" />
599
+            <element signature="e#5042#5043#0" expanded="true" />
600
+            <element signature="e#5115#5116#0" expanded="true" />
601
+            <element signature="e#5173#5174#0" expanded="true" />
602
+            <element signature="e#5234#5235#0" expanded="true" />
603
+            <element signature="e#5305#5306#0" expanded="true" />
604
+            <element signature="e#5342#5343#0" expanded="true" />
567 605
           </folding>
568 606
         </state>
569 607
       </provider>
570 608
     </entry>
571 609
     <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
572 610
       <provider selected="true" editor-type-id="text-editor">
573
-        <state relative-caret-position="533">
574
-          <caret line="363" column="63" selection-start-line="363" selection-start-column="63" selection-end-line="363" selection-end-column="63" />
611
+        <state relative-caret-position="300">
612
+          <caret line="462" column="5" lean-forward="true" selection-start-line="462" selection-start-column="5" selection-end-line="462" selection-end-column="5" />
575 613
           <folding>
576 614
             <element signature="imports" expanded="true" />
577 615
           </folding>

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

@@ -104,11 +104,12 @@ public class Arraz {
104 104
     public int[] insertArrayAt(int[] array, int index, int value){
105 105
         int[] newArray = new int[array.length + 1];
106 106
         int counter = 0;
107
-        for (int i = 0; i < array.length-1; i++) {
108
-            if (i == index){
109
-                newArray[index] = value;
107
+        for (int i = 0; i < array.length; i++) {
108
+            if (counter == index){
109
+                newArray[counter] = value;
110 110
                 counter++;
111
-            }else {
111
+                i--;
112
+            }else{
112 113
                 newArray[counter] = array[i];
113 114
                 counter++;
114 115
             }
@@ -170,4 +171,31 @@ public class Arraz {
170 171
         }
171 172
         return false;
172 173
     }
174
+
175
+    public Integer[] min2Array(Integer[] array){
176
+        Set<Integer> minSet = new TreeSet<>(Arrays.asList(array));
177
+        return Arrays.copyOfRange(minSet.toArray(new Integer[0]), 0, 2);
178
+    }
179
+
180
+    public int[] reverseCopy(int[] array){
181
+       return reverseArray(array);
182
+    }
183
+
184
+    public int[] removeLastItemCopy(int[] array){
185
+        return removeElementFromArray(array, array[array.length-1]);
186
+    }
187
+
188
+    public int[] removeFirstItemCopy(int[] array){
189
+        return removeElementFromArray(array, array[0]);
190
+    }
191
+
192
+    public int[] insertStartCopy(int[] array, int value){
193
+        return insertArrayAt(array, 0, value);
194
+    }
195
+
196
+    public Integer[] insertEndCopy(Integer[] array, int value){
197
+        List<Integer> list = new ArrayList<>(Arrays.asList(array));
198
+        list.add(value);
199
+        return list.toArray(new Integer[0]);
200
+    }
173 201
 }

+ 102
- 5
arraz/src/test/java/ArrazTest.java Näytä tiedosto

@@ -3,7 +3,6 @@
3 3
 import org.junit.Assert;
4 4
 import org.junit.Before;
5 5
 import org.junit.Test;
6
-
7 6
 import java.util.ArrayList;
8 7
 import java.util.Arrays;
9 8
 import java.util.List;
@@ -197,16 +196,18 @@ public class ArrazTest {
197 196
 
198 197
     @Test
199 198
     public void testInsertArrayAt1(){
200
-        int[] expected = new int[]{5, 10, 17, 3, 29, 100};
201
-        int[] actual = testArraz.insertArrayAt(arr1, 2, 17);
199
+        int[] expected = new int[]{5, 10, 3, 17, 29, 100};
200
+        int[] actual = testArraz.insertArrayAt(arr1, 3, 17);
201
+        System.out.println(Arrays.toString(actual));
202 202
 
203 203
         Assert.assertArrayEquals(expected, actual);
204 204
     }
205 205
 
206 206
     @Test
207 207
     public void testInsertArrayAt2(){
208
-        int[] expected =  new int[]{2, 7, 432, 89, 6};
209
-        int[] actual = testArraz.insertArrayAt(arr2, 4, 6);
208
+        int[] expected =  new int[]{2, 6, 7, 432, 89};
209
+        int[] actual = testArraz.insertArrayAt(arr2, 1, 6);
210
+        System.out.println(Arrays.toString(actual));
210 211
 
211 212
         Assert.assertArrayEquals(expected, actual);
212 213
     }
@@ -364,4 +365,100 @@ public class ArrazTest {
364 365
         Assert.assertFalse(testArraz.theTotalOfTenIs30(array));
365 366
     }
366 367
 
368
+    @Test
369
+    public void testMin2Array1(){
370
+        Integer[] expected = new Integer[]{3, 5};
371
+        Integer[] actual = testArraz.min2Array(new Integer[]{100, 54, 10, 78, 10, 5, 3});
372
+
373
+        Assert.assertArrayEquals(expected, actual);
374
+    }
375
+
376
+    @Test
377
+    public void testMin2Array(){
378
+        Integer[] expected = new Integer[]{1, 10};
379
+        Integer[] actual = testArraz.min2Array(new Integer[]{1,1,1,1,10});
380
+
381
+        Assert.assertArrayEquals(expected, actual);
382
+    }
383
+
384
+    @Test
385
+    public void testReverseCopy1(){
386
+        int[] expected = new int[]{100, 29, 3, 10, 5};
387
+        int[] actual = testArraz.reverseCopy(arr1);
388
+
389
+        Assert.assertArrayEquals(expected,actual);
390
+    }
391
+
392
+    @Test
393
+    public void testReverseCopy2(){
394
+        int[] expected = new int[]{89, 432, 7, 2};
395
+        int[] actual = testArraz.reverseCopy(arr2);
396
+
397
+        Assert.assertArrayEquals(expected, actual);
398
+    }
399
+
400
+    @Test
401
+    public void testRemoveLastItemCopy1(){
402
+        int[] expected = new int[]{5, 10, 3, 29};
403
+        int[] actual = testArraz.removeLastItemCopy(arr1);
404
+
405
+        Assert.assertArrayEquals(expected, actual);
406
+    }
407
+
408
+    @Test
409
+    public void testRemoveLastItemCopy2(){
410
+        int[] expected =  new int[]{2, 7, 432};
411
+        int[] actual = testArraz.removeLastItemCopy(arr2);
412
+
413
+        Assert.assertArrayEquals(expected, actual);
414
+    }
415
+
416
+    @Test
417
+    public void testRemoveFirstItemCopy1(){
418
+        int[] expected = new int[]{7, 432, 89};
419
+        int[] actual = testArraz.removeFirstItemCopy(arr2);
420
+
421
+        Assert.assertArrayEquals(expected, actual);
422
+    }
423
+
424
+    @Test
425
+    public void testRemoveFirstItemCopy2(){
426
+        int[] expected = new int[]{10, 3, 29, 100};
427
+        int[] actual = testArraz.removeFirstItemCopy(arr1);
428
+
429
+        Assert.assertArrayEquals(expected, actual);
430
+    }
431
+
432
+    @Test
433
+    public void testInsertStartCopy1(){
434
+        int[] expected = new int[]{4, 5, 10, 3, 29, 100};
435
+        int[] actual = testArraz.insertStartCopy(arr1, 4);
436
+
437
+        Assert.assertArrayEquals(expected, actual);
438
+    }
439
+
440
+    @Test
441
+    public void testInsertStartCopy2(){
442
+        int[] expected = new int[]{56, 2, 7, 432, 89};
443
+        int[] actual = testArraz.insertStartCopy(arr2, 56);
444
+
445
+        Assert.assertArrayEquals(expected, actual);
446
+    }
447
+
448
+    @Test
449
+    public void testInsertEndCopy1(){
450
+        Integer[] expected = new Integer[]{2, 7, 432, 89, 9};
451
+        Integer[] actual = testArraz.insertEndCopy(new Integer[]{2, 7, 432, 89}, 9);
452
+
453
+        Assert.assertArrayEquals(expected, actual);
454
+    }
455
+
456
+    @Test
457
+    public void testInsertEndCopy2(){
458
+        Integer[] expected = new Integer[]{5, 10, 3, 29, 100, 90};
459
+        Integer[] actual = testArraz.insertEndCopy(new Integer[]{5, 10, 3, 29, 100}, 90);
460
+        System.out.println(Arrays.toString(actual));
461
+
462
+        Assert.assertArrayEquals(expected, actual);
463
+    }
367 464
 }