/
AllInstructionsWithoutDummiesInCPTest.java
872 lines (729 loc) · 21.2 KB
/
AllInstructionsWithoutDummiesInCPTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
package org.isk.jvmhardcore.pjba;
import org.junit.Assert;
import org.junit.Test;
public class AllInstructionsWithoutDummiesInCPTest {
@Test
public void nop() {
AllInstructionsWithoutDummiesInCP.nop();
}
@Test
public void aconst_null() {
final Object o = AllInstructionsWithoutDummiesInCP.aconst_null();
Assert.assertNull(o);
}
@Test
public void iconst_m1() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_m1();
Assert.assertEquals(-1, i);
}
@Test
public void iconst_0() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_0();
Assert.assertEquals(0, i);
}
@Test
public void iconst_1() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_1();
Assert.assertEquals(1, i);
}
@Test
public void iconst_2() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_2();
Assert.assertEquals(2, i);
}
@Test
public void iconst_3() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_3();
Assert.assertEquals(3, i);
}
@Test
public void iconst_4() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_4();
Assert.assertEquals(4, i);
}
@Test
public void iconst_5() {
final int i = AllInstructionsWithoutDummiesInCP.iconst_5();
Assert.assertEquals(5, i);
}
@Test
public void lconst_0() {
final long l = AllInstructionsWithoutDummiesInCP.lconst_0();
Assert.assertEquals(0l, l);
}
@Test
public void lconst_1() {
final long l = AllInstructionsWithoutDummiesInCP.lconst_1();
Assert.assertEquals(1l, l);
}
@Test
public void fconst_0() {
final float f = AllInstructionsWithoutDummiesInCP.fconst_0();
Assert.assertEquals(0f, f, 0.0001);
}
@Test
public void fconst_1() {
final float f = AllInstructionsWithoutDummiesInCP.fconst_1();
Assert.assertEquals(1f, f, 0.0001);
}
@Test
public void fconst_2() {
final float f = AllInstructionsWithoutDummiesInCP.fconst_2();
Assert.assertEquals(2f, f, 0.0001);
}
@Test
public void dconst_0() {
final double d = AllInstructionsWithoutDummiesInCP.dconst_0();
Assert.assertEquals(0.0, d, 0.0001);
}
@Test
public void dconst_1() {
final double d = AllInstructionsWithoutDummiesInCP.dconst_1();
Assert.assertEquals(1.0, d, 0.0001);
}
@Test
public void bipush() {
final int i = AllInstructionsWithoutDummiesInCP.bipush();
Assert.assertEquals(125, i);
}
@Test
public void sipush() {
final int i = AllInstructionsWithoutDummiesInCP.sipush();
Assert.assertEquals(5_396, i);
}
@Test
public void ldc_String() {
final String s = AllInstructionsWithoutDummiesInCP.ldc_String();
Assert.assertEquals("Hello World", s);
}
@Test
public void ldc_int() {
final int i = AllInstructionsWithoutDummiesInCP.ldc_int();
Assert.assertEquals(167_980_564, i);
}
@Test
public void ldc_float() {
final float f = AllInstructionsWithoutDummiesInCP.ldc_float();
Assert.assertEquals(3.5f, f, 0.0001);
}
@Test
public void ldc_long() {
final long l = AllInstructionsWithoutDummiesInCP.ldc_long();
Assert.assertEquals(167_980_564_900l, l);
}
@Test
public void ldc_double() {
final double d = AllInstructionsWithoutDummiesInCP.ldc_double();
Assert.assertEquals(3.578_978_979, d, 0.0001);
}
@Test
public void iload() {
final int i = AllInstructionsWithoutDummiesInCP
.iload(true, true, true, true, true, true, true, true, true, true, 5);
Assert.assertEquals(5, i);
}
@Test
public void lload() {
final long l = AllInstructionsWithoutDummiesInCP.lload(true, true, true, true, true, true, true, true, true, true,
15l);
Assert.assertEquals(15l, l);
}
@Test
public void fload() {
final float f = AllInstructionsWithoutDummiesInCP.fload(true, true, true, true, true, true, true, true, true, true,
5.5f);
Assert.assertEquals(5.5f, f, 0.0001);
}
@Test
public void dload() {
final double d = AllInstructionsWithoutDummiesInCP.dload(true, true, true, true, true, true, true, true, true,
true, 5.9);
Assert.assertEquals(5.9, d, 0.0001);
}
@Test
public void aload() {
final Integer i = AllInstructionsWithoutDummiesInCP.aload(true, true, true, true, true, true, true, true, true,
true, 89);
Assert.assertEquals(89, i.intValue());
}
@Test
public void iload_0() {
final int i = AllInstructionsWithoutDummiesInCP.iload_0(5);
Assert.assertEquals(5, i);
}
@Test
public void iload_1() {
final int i = AllInstructionsWithoutDummiesInCP.iload_1(true, 5);
Assert.assertEquals(5, i);
}
@Test
public void iload_2() {
final int i = AllInstructionsWithoutDummiesInCP.iload_2(true, true, 5);
Assert.assertEquals(5, i);
}
@Test
public void iload_3() {
final int i = AllInstructionsWithoutDummiesInCP.iload_3(true, true, true, 5);
Assert.assertEquals(5, i);
}
@Test
public void lload_0() {
final long l = AllInstructionsWithoutDummiesInCP.lload_0(15l);
Assert.assertEquals(15l, l);
}
@Test
public void lload_1() {
final long l = AllInstructionsWithoutDummiesInCP.lload_1(true, 15l);
Assert.assertEquals(15l, l);
}
@Test
public void lload_2() {
final long l = AllInstructionsWithoutDummiesInCP.lload_2(true, true, 15l);
Assert.assertEquals(15l, l);
}
@Test
public void lload_3() {
final long l = AllInstructionsWithoutDummiesInCP.lload_3(true, true, true, 15l);
Assert.assertEquals(15l, l);
}
@Test
public void fload_0() {
final float f = AllInstructionsWithoutDummiesInCP.fload_0(5.5f);
Assert.assertEquals(5.5f, f, 0.0001);
}
@Test
public void fload_1() {
final float f = AllInstructionsWithoutDummiesInCP.fload_1(true, 5.5f);
Assert.assertEquals(5.5f, f, 0.0001);
}
@Test
public void fload_2() {
final float f = AllInstructionsWithoutDummiesInCP.fload_2(true, true, 5.5f);
Assert.assertEquals(5.5f, f, 0.0001);
}
@Test
public void fload_3() {
final float f = AllInstructionsWithoutDummiesInCP.fload_3(true, true, true, 5.5f);
Assert.assertEquals(5.5f, f, 0.0001);
}
@Test
public void dload_0() {
final double d = AllInstructionsWithoutDummiesInCP.dload_0(5.9);
Assert.assertEquals(5.9, d, 0.0001);
}
@Test
public void dload_1() {
final double d = AllInstructionsWithoutDummiesInCP.dload_1(true, 5.9);
Assert.assertEquals(5.9, d, 0.0001);
}
@Test
public void dload_2() {
final double d = AllInstructionsWithoutDummiesInCP.dload_2(true, true, 5.9);
Assert.assertEquals(5.9, d, 0.0001);
}
@Test
public void dload_3() {
final double d = AllInstructionsWithoutDummiesInCP.dload_3(true, true, true, 5.9);
Assert.assertEquals(5.9, d, 0.0001);
}
@Test
public void aload_0() {
final Integer expected = new Integer(5000);
final Integer i = AllInstructionsWithoutDummiesInCP.aload_0(expected);
Assert.assertTrue(i == expected);
}
@Test
public void aload_1() {
final Integer expected = new Integer(5000);
final Integer i = AllInstructionsWithoutDummiesInCP.aload_1(true, expected);
Assert.assertTrue(i == expected);
}
@Test
public void aload_2() {
final Integer expected = new Integer(5000);
final Integer i = AllInstructionsWithoutDummiesInCP.aload_2(true, true, expected);
Assert.assertTrue(i == expected);
}
@Test
public void aload_3() {
final Integer expected = new Integer(5000);
final Integer i = AllInstructionsWithoutDummiesInCP.aload_3(true, true, true, expected);
Assert.assertTrue(i == expected);
}
@Test
public void istore() {
final int i = AllInstructionsWithoutDummiesInCP.istore(2, true, true, true, true, true, true, true, true, true, 4);
Assert.assertEquals(2, i);
}
@Test
public void lstore() {
final long l = AllInstructionsWithoutDummiesInCP.lstore(2l, true, true, true, true, true, true, true, true, 4l);
Assert.assertEquals(2l, l);
}
@Test
public void fstore() {
final float f = AllInstructionsWithoutDummiesInCP.fstore(2.5f, true, true, true, true, true, true, true, true,
true, 4.5f);
Assert.assertEquals(2.5f, f, 0.0001);
}
@Test
public void dstore() {
final double d = AllInstructionsWithoutDummiesInCP.dstore(2.98, true, true, true, true, true, true, true, true,
40.56);
Assert.assertEquals(2.98, d, 0.0001);
}
@Test
public void astore() {
final Integer i = AllInstructionsWithoutDummiesInCP.astore(2, true, true, true, true, true, true, true, true, true,
4);
Assert.assertEquals(2, i.intValue());
}
@Test
public void istore_0() {
final int i = AllInstructionsWithoutDummiesInCP.istore_0(2, 4);
Assert.assertEquals(11, i);
}
@Test
public void istore_1() {
final int i = AllInstructionsWithoutDummiesInCP.istore_1(2, 4);
Assert.assertEquals(9, i);
}
@Test
public void istore_2() {
final int i = AllInstructionsWithoutDummiesInCP.istore_2(2, 5, 6);
Assert.assertEquals(7, i);
}
@Test
public void istore_3() {
final int i = AllInstructionsWithoutDummiesInCP.istore_3(2, 5, 6, 7);
Assert.assertEquals(8, i);
}
@Test
public void lstore_0() {
final long l = AllInstructionsWithoutDummiesInCP.lstore_0(2l, 4l);
Assert.assertEquals(11l, l);
}
@Test
public void lstore_1() {
final long l = AllInstructionsWithoutDummiesInCP.lstore_1(2, 4l);
Assert.assertEquals(9l, l);
}
@Test
public void lstore_2() {
final long l = AllInstructionsWithoutDummiesInCP.lstore_2(2l, 5l);
Assert.assertEquals(3l, l);
}
@Test
public void lstore_3() {
final long l = AllInstructionsWithoutDummiesInCP.lstore_3(2l, 5);
Assert.assertEquals(7l, l);
}
@Test
public void fstore_0() {
final float f = AllInstructionsWithoutDummiesInCP.fstore_0(2f, 4f);
Assert.assertEquals(11f, f, 0.0001);
}
@Test
public void fstore_1() {
final float f = AllInstructionsWithoutDummiesInCP.fstore_1(2f, 4f);
Assert.assertEquals(9f, f, 0.0001);
}
@Test
public void fstore_2() {
final float f = AllInstructionsWithoutDummiesInCP.fstore_2(2f, 5f, 6f);
Assert.assertEquals(7f, f, 0.0001);
}
@Test
public void fstore_3() {
final float f = AllInstructionsWithoutDummiesInCP.fstore_3(2f, 5f, 6f, 7f);
Assert.assertEquals(8f, f, 0.0001);
}
@Test
public void dstore_0() {
final double d = AllInstructionsWithoutDummiesInCP.dstore_0(2.0, 4.0);
Assert.assertEquals(11.0, d, 0.0001);
}
@Test
public void dstore_1() {
final double d = AllInstructionsWithoutDummiesInCP.dstore_1(2.0f, 4.0);
Assert.assertEquals(9.0, d, 0.0001);
}
@Test
public void dstore_2() {
final double d = AllInstructionsWithoutDummiesInCP.dstore_2(2.0, 5.0);
Assert.assertEquals(3.0, d, 0.0001);
}
@Test
public void dstore_3() {
final double d = AllInstructionsWithoutDummiesInCP.dstore_3(2.0, 5.0f);
Assert.assertEquals(7.0, d, 0.0001);
}
@Test
public void astore_0() {
final int i = AllInstructionsWithoutDummiesInCP.astore_0(2);
Assert.assertEquals(2, i, 0.0001);
}
@Test
public void astore_1() {
final int i = AllInstructionsWithoutDummiesInCP.astore_1(2, 5);
Assert.assertEquals(2, i, 0.0001);
}
@Test
public void astore_2() {
final int i = AllInstructionsWithoutDummiesInCP.astore_2(2, 5, 4);
Assert.assertEquals(2, i, 0.0001);
}
@Test
public void astore_3() {
final int i = AllInstructionsWithoutDummiesInCP.astore_3(2, 5, 4, 7);
Assert.assertEquals(2, i, 0.0001);
}
@Test
public void pop() {
final double d = AllInstructionsWithoutDummiesInCP.pop();
Assert.assertEquals(0.0, d, 0.0001);
}
@Test
public void pop2() {
final int i = AllInstructionsWithoutDummiesInCP.pop2();
Assert.assertEquals(3, i);
}
@Test
public void dup() {
final int i = AllInstructionsWithoutDummiesInCP.dup();
Assert.assertEquals(2, i);
}
@Test
public void dup_x1() {
final int i = AllInstructionsWithoutDummiesInCP.dup_x1();
Assert.assertEquals(1, i);
}
@Test
public void dup_x2() {
final int i = AllInstructionsWithoutDummiesInCP.dup_x2();
Assert.assertEquals(1, i);
}
@Test
public void dup2() {
final double d = AllInstructionsWithoutDummiesInCP.dup2();
Assert.assertEquals(2.0, d, 0.0001);
}
@Test
public void dup2_x1() {
final double d = AllInstructionsWithoutDummiesInCP.dup2_x1();
Assert.assertEquals(1.0, d, 0.0001);
}
@Test
public void dup2_x2() {
final double d = AllInstructionsWithoutDummiesInCP.dup2_x2();
Assert.assertEquals(1.0, d, 0.0001);
}
@Test
public void swap() {
final int i = AllInstructionsWithoutDummiesInCP.swap();
Assert.assertEquals(1, i);
}
@Test
public void iadd() {
final int i = AllInstructionsWithoutDummiesInCP.iadd(5, 10);
Assert.assertEquals(15, i);
}
@Test
public void ladd() {
final long l = AllInstructionsWithoutDummiesInCP.ladd(15l, 100l);
Assert.assertEquals(115l, l);
}
@Test
public void fadd() {
final float f = AllInstructionsWithoutDummiesInCP.fadd(5.5f, 10.5f);
Assert.assertEquals(16.0f, f, 0.0001);
}
@Test
public void dadd() {
final double d = AllInstructionsWithoutDummiesInCP.dadd(5.9, 10.9);
Assert.assertEquals(16.8, d, 0.0001);
}
@Test
public void isub() {
final int i = AllInstructionsWithoutDummiesInCP.isub(5, 10);
Assert.assertEquals(-5, i);
}
@Test
public void lsub() {
final long l = AllInstructionsWithoutDummiesInCP.lsub(15l, 100l);
Assert.assertEquals(-85l, l);
}
@Test
public void fsub() {
final float f = AllInstructionsWithoutDummiesInCP.fsub(5.5f, 10.5f);
Assert.assertEquals(-5.0f, f, 0.0001);
}
@Test
public void dsub() {
final double d = AllInstructionsWithoutDummiesInCP.dsub(5.9, 10.9);
Assert.assertEquals(-5.0, d, 0.0001);
}
@Test
public void imul() {
final int i = AllInstructionsWithoutDummiesInCP.imul(5, 10);
Assert.assertEquals(50, i);
}
@Test
public void lmul() {
final long l = AllInstructionsWithoutDummiesInCP.lmul(15l, 100l);
Assert.assertEquals(1500l, l);
}
@Test
public void fmul() {
final float f = AllInstructionsWithoutDummiesInCP.fmul(5.2f, 10.5f);
Assert.assertEquals(54.6f, f, 0.0001);
}
@Test
public void dmul() {
final double d = AllInstructionsWithoutDummiesInCP.dmul(5.9, 10.9);
Assert.assertEquals(64.31, d, 0.0001);
}
@Test
public void idiv() {
final int i = AllInstructionsWithoutDummiesInCP.idiv(10, 5);
Assert.assertEquals(2, i);
}
@Test
public void ldiv() {
final long l = AllInstructionsWithoutDummiesInCP.ldiv(150l, 10l);
Assert.assertEquals(15l, l);
}
@Test
public void fdiv() {
final float f = AllInstructionsWithoutDummiesInCP.fdiv(10.5f, 5.5f);
Assert.assertEquals(1.90f, f, 0.01);
}
@Test
public void ddiv() {
final double d = AllInstructionsWithoutDummiesInCP.ddiv(10.0, 2.0);
Assert.assertEquals(5.0, d, 0.0001);
}
@Test
public void irem() {
final int i = AllInstructionsWithoutDummiesInCP.irem(7, 2);
Assert.assertEquals(1, i);
}
@Test
public void lrem() {
final long l = AllInstructionsWithoutDummiesInCP.lrem(155l, 10l);
Assert.assertEquals(5l, l);
}
@Test
public void frem() {
final float f = AllInstructionsWithoutDummiesInCP.frem(0.5f, 0.3f);
Assert.assertEquals(0.2f, f, 0.01);
}
@Test
public void drem() {
final double d = AllInstructionsWithoutDummiesInCP.drem(17.5, 15.3);
Assert.assertEquals(2.2, d, 0.01);
}
@Test
public void ineg() {
final int i = AllInstructionsWithoutDummiesInCP.ineg(7);
Assert.assertEquals(-7, i);
}
@Test
public void lneg() {
final long l = AllInstructionsWithoutDummiesInCP.lneg(-155l);
Assert.assertEquals(155l, l);
}
@Test
public void fneg() {
final float f = AllInstructionsWithoutDummiesInCP.fneg(0.5f);
Assert.assertEquals(-0.5f, f, 0.0001);
}
@Test
public void dneg() {
final double d = AllInstructionsWithoutDummiesInCP.dneg(-17.5);
Assert.assertEquals(17.5, d, 0.0001);
}
// ..., value1, value2 → ..., result
// An int result is calculated by shifting value1 left by s bit positions,
// where s is the value of the low 5 bits of value2. (5 bits => 0 to 31)
@Test
public void ishl0() {
final int i = AllInstructionsWithoutDummiesInCP.ishl(10, 32);
Assert.assertEquals(10, i);
}
@Test
public void ishl1() {
final int i = AllInstructionsWithoutDummiesInCP.ishl(1, 31);
Assert.assertEquals(Integer.MIN_VALUE, i);
}
@Test
public void lshl0() {
final int i = AllInstructionsWithoutDummiesInCP.ishl(10, 64);
Assert.assertEquals(10, i);
}
@Test
public void lshl1() {
final long l = AllInstructionsWithoutDummiesInCP.lshl(1, 63);
Assert.assertEquals(Long.MIN_VALUE, l);
}
@Test
public void ishr0() {
final int i = AllInstructionsWithoutDummiesInCP.ishr(10, 32);
Assert.assertEquals(10, i);
}
@Test
public void ishr1() {
final int i = AllInstructionsWithoutDummiesInCP.ishr(Integer.MIN_VALUE, 31);
Assert.assertEquals(-1, i);
}
@Test
public void lshr0() {
final long l = AllInstructionsWithoutDummiesInCP.lshr(10, 64);
Assert.assertEquals(10, l);
}
@Test
public void lshr1() {
final long l = AllInstructionsWithoutDummiesInCP.lshr(Long.MIN_VALUE, 63);
Assert.assertEquals(-1, l);
}
@Test
public void iushr() {
final int i = AllInstructionsWithoutDummiesInCP.iushr(Integer.MIN_VALUE, 31);
Assert.assertEquals(1, i);
}
@Test
public void lushr() {
final long l = AllInstructionsWithoutDummiesInCP.lushr(Long.MIN_VALUE, 63);
Assert.assertEquals(1, l);
}
@Test
public void iand() {
final int i = AllInstructionsWithoutDummiesInCP.iand(5, 4);
Assert.assertEquals(4, i);
}
@Test
public void land() {
final long l = AllInstructionsWithoutDummiesInCP.land(Long.MAX_VALUE, Long.MIN_VALUE);
Assert.assertEquals(0, l);
}
@Test
public void ior() {
final int i = AllInstructionsWithoutDummiesInCP.ior(5, 4);
Assert.assertEquals(5, i);
}
@Test
public void lor() {
final long l = AllInstructionsWithoutDummiesInCP.lor(Long.MAX_VALUE, Long.MIN_VALUE);
Assert.assertEquals(-1, l);
}
@Test
public void ixor() {
final int i = AllInstructionsWithoutDummiesInCP.ixor(5, 4);
Assert.assertEquals(1, i);
}
@Test
public void lxor() {
final long l = AllInstructionsWithoutDummiesInCP.lxor(Long.MAX_VALUE, Long.MIN_VALUE);
Assert.assertEquals(-1, l);
}
@Test
public void i2l() {
final long l = AllInstructionsWithoutDummiesInCP.i2l(5, 4l);
Assert.assertEquals(9, l);
}
@Test
public void i2f() {
final float f = AllInstructionsWithoutDummiesInCP.i2f(5, 2);
Assert.assertEquals(2.5f, f, 0.0001);
}
@Test
public void i2d() {
final double d = AllInstructionsWithoutDummiesInCP.i2d(10, 3);
Assert.assertEquals(3.33, d, 0.01);
}
@Test
public void l2i() {
final int i = AllInstructionsWithoutDummiesInCP.l2i(Long.MAX_VALUE);
Assert.assertEquals(-1, i);
}
@Test
public void l2f() {
final float f = AllInstructionsWithoutDummiesInCP.l2f(5l, 2l);
Assert.assertEquals(2.5f, f, 0.0001);
}
@Test
public void l2d() {
final double d = AllInstructionsWithoutDummiesInCP.l2d(10l, 3l);
Assert.assertEquals(3.33, d, 0.01);
}
@Test
public void f2i() {
final int i = AllInstructionsWithoutDummiesInCP.f2i(4.56f);
Assert.assertEquals(4, i);
}
@Test
public void f2l() {
final long l = AllInstructionsWithoutDummiesInCP.f2l(45.908f);
Assert.assertEquals(45, l);
}
@Test
public void f2d() {
final double d = AllInstructionsWithoutDummiesInCP.f2d(10.5f, 5.6f);
Assert.assertEquals(16.1, d, 0.01);
}
@Test
public void d2i() {
final int i = AllInstructionsWithoutDummiesInCP.d2i(4.56f);
Assert.assertEquals(4, i);
}
@Test
public void d2l() {
final long l = AllInstructionsWithoutDummiesInCP.d2l(45.908f);
Assert.assertEquals(45, l);
}
@Test
public void d2f() {
final float f = AllInstructionsWithoutDummiesInCP.d2f(10.5f, 5.6f);
Assert.assertEquals(16.1f, f, 0.01);
}
@Test
public void i2b() {
final int i = AllInstructionsWithoutDummiesInCP.i2b(Integer.MAX_VALUE);
Assert.assertEquals(-1, i);
}
@Test
public void i2c() {
final int i = AllInstructionsWithoutDummiesInCP.i2c(Integer.MAX_VALUE);
Assert.assertEquals(65_535, i);
}
@Test
public void i2s() {
final int i = AllInstructionsWithoutDummiesInCP.i2s(Integer.MAX_VALUE);
Assert.assertEquals(-1, i);
}
@Test
public void istore_load_unsigned() {
final int i = AllInstructionsWithoutDummiesInCP.istore_load_unsigned();
Assert.assertEquals(7_687, i);
}
@Test
public void lstore_load_unsigned() {
final long l = AllInstructionsWithoutDummiesInCP.lstore_load_unsigned();
Assert.assertEquals(7_687_000, l);
}
@Test
public void fstore_load_unsigned() {
final float f = AllInstructionsWithoutDummiesInCP.fstore_load_unsigned();
Assert.assertEquals(134.89f, f, 0.0001);
}
@Test
public void dstore_load_unsigned() {
final double d = AllInstructionsWithoutDummiesInCP.dstore_load_unsigned();
Assert.assertEquals(33.33, d, 0.0001);
}
@Test
public void astore_load_unsigned() {
final Object o = AllInstructionsWithoutDummiesInCP.astore_load_unsigned();
Assert.assertNull(o);
}
}