Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/jdk/java/nio/Buffer/BasicDouble.java
66644 views
1
/*
2
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/* Type-specific source code for unit test
25
*
26
* Regenerate the BasicX classes via genBasic.sh whenever this file changes.
27
* We check in the generated source files so that the test tree can be used
28
* independently of the rest of the source tree.
29
*/
30
31
// -- This file was mechanically generated: Do not edit! -- //
32
33
34
35
36
37
import java.nio.*;
38
39
40
41
42
43
44
45
46
public class BasicDouble
47
extends Basic
48
{
49
50
private static final double[] VALUES = {
51
Double.MIN_VALUE,
52
(double) -1,
53
(double) 0,
54
(double) 1,
55
Double.MAX_VALUE,
56
57
58
59
60
61
62
63
Double.NEGATIVE_INFINITY,
64
Double.POSITIVE_INFINITY,
65
Double.NaN,
66
(double) -0.0,
67
68
};
69
70
private static void relGet(DoubleBuffer b) {
71
int n = b.capacity();
72
for (int i = 0; i < n; i++)
73
ck(b, (long)b.get(), (long)((double)ic(i)));
74
b.rewind();
75
}
76
77
private static void relGet(DoubleBuffer b, int start) {
78
int n = b.remaining();
79
for (int i = start; i < n; i++)
80
ck(b, (long)b.get(), (long)((double)ic(i)));
81
b.rewind();
82
}
83
84
private static void absGet(DoubleBuffer b) {
85
int n = b.capacity();
86
for (int i = 0; i < n; i++)
87
ck(b, (long)b.get(), (long)((double)ic(i)));
88
b.rewind();
89
}
90
91
private static void bulkGet(DoubleBuffer b) {
92
int n = b.capacity();
93
double[] a = new double[n + 7];
94
b.get(a, 7, n);
95
for (int i = 0; i < n; i++) {
96
ck(b, (long)a[i + 7], (long)((double)ic(i)));
97
}
98
}
99
100
private static void absBulkGet(DoubleBuffer b) {
101
int n = b.capacity();
102
int len = n - 7*2;
103
double[] a = new double[n + 7];
104
b.position(42);
105
b.get(7, a, 7, len);
106
ck(b, b.position() == 42);
107
for (int i = 0; i < len; i++) {
108
ck(b, (long)a[i + 7], (long)((double)ic(i)));
109
}
110
}
111
112
private static void relPut(DoubleBuffer b) {
113
int n = b.capacity();
114
b.clear();
115
for (int i = 0; i < n; i++)
116
b.put((double)ic(i));
117
b.flip();
118
}
119
120
private static void absPut(DoubleBuffer b) {
121
int n = b.capacity();
122
b.clear();
123
for (int i = 0; i < n; i++)
124
b.put(i, (double)ic(i));
125
b.limit(n);
126
b.position(0);
127
}
128
129
private static void bulkPutArray(DoubleBuffer b) {
130
int n = b.capacity();
131
b.clear();
132
double[] a = new double[n + 7];
133
for (int i = 0; i < n; i++)
134
a[i + 7] = (double)ic(i);
135
b.put(a, 7, n);
136
b.flip();
137
}
138
139
private static void bulkPutBuffer(DoubleBuffer b) {
140
int n = b.capacity();
141
b.clear();
142
DoubleBuffer c = DoubleBuffer.allocate(n + 7);
143
c.position(7);
144
for (int i = 0; i < n; i++)
145
c.put((double)ic(i));
146
c.flip();
147
c.position(7);
148
b.put(c);
149
b.flip();
150
try {
151
b.put(b);
152
fail("IllegalArgumentException expected for put into same buffer");
153
} catch (IllegalArgumentException e) {
154
if (e.getMessage() == null) {
155
fail("Non-null IllegalArgumentException message expected from"
156
+ " put into same buffer");
157
}
158
}
159
}
160
161
private static void absBulkPutArray(DoubleBuffer b) {
162
int n = b.capacity();
163
b.clear();
164
int lim = n - 7;
165
int len = lim - 7;
166
b.limit(lim);
167
double[] a = new double[len + 7];
168
for (int i = 0; i < len; i++)
169
a[i + 7] = (double)ic(i);
170
b.position(42);
171
b.put(7, a, 7, len);
172
ck(b, b.position() == 42);
173
}
174
175
//6231529
176
private static void callReset(DoubleBuffer b) {
177
b.position(0);
178
b.mark();
179
180
b.duplicate().reset();
181
b.asReadOnlyBuffer().reset();
182
}
183
184
185
186
// 6221101-6234263
187
188
private static void putBuffer() {
189
final int cap = 10;
190
191
DoubleBuffer direct1 = ByteBuffer.allocateDirect(cap).asDoubleBuffer();
192
DoubleBuffer nondirect1 = ByteBuffer.allocate(cap).asDoubleBuffer();
193
direct1.put(nondirect1);
194
195
DoubleBuffer direct2 = ByteBuffer.allocateDirect(cap).asDoubleBuffer();
196
DoubleBuffer nondirect2 = ByteBuffer.allocate(cap).asDoubleBuffer();
197
nondirect2.put(direct2);
198
199
DoubleBuffer direct3 = ByteBuffer.allocateDirect(cap).asDoubleBuffer();
200
DoubleBuffer direct4 = ByteBuffer.allocateDirect(cap).asDoubleBuffer();
201
direct3.put(direct4);
202
203
DoubleBuffer nondirect3 = ByteBuffer.allocate(cap).asDoubleBuffer();
204
DoubleBuffer nondirect4 = ByteBuffer.allocate(cap).asDoubleBuffer();
205
nondirect3.put(nondirect4);
206
}
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
private static void checkSlice(DoubleBuffer b, DoubleBuffer slice) {
225
ck(slice, 0, slice.position());
226
ck(slice, b.remaining(), slice.limit());
227
ck(slice, b.remaining(), slice.capacity());
228
if (b.isDirect() != slice.isDirect())
229
fail("Lost direction", slice);
230
if (b.isReadOnly() != slice.isReadOnly())
231
fail("Lost read-only", slice);
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
private static void fail(String problem,
553
DoubleBuffer xb, DoubleBuffer yb,
554
double x, double y) {
555
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
556
}
557
558
private static void catchNullArgument(Buffer b, Runnable thunk) {
559
tryCatch(b, NullPointerException.class, thunk);
560
}
561
562
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
563
tryCatch(b, IllegalArgumentException.class, thunk);
564
}
565
566
private static void catchReadOnlyBuffer(Buffer b, Runnable thunk) {
567
tryCatch(b, ReadOnlyBufferException.class, thunk);
568
}
569
570
private static void catchIndexOutOfBounds(Buffer b, Runnable thunk) {
571
tryCatch(b, IndexOutOfBoundsException.class, thunk);
572
}
573
574
private static void catchIndexOutOfBounds(double[] t, Runnable thunk) {
575
tryCatch(t, IndexOutOfBoundsException.class, thunk);
576
}
577
578
private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) {
579
boolean caught = false;
580
try {
581
thunk.run();
582
} catch (Throwable x) {
583
if (ex.isAssignableFrom(x.getClass())) {
584
caught = true;
585
} else {
586
String s = x.getMessage();
587
if (s == null)
588
s = x.getClass().getName();
589
fail(s + " not expected");
590
}
591
}
592
if (!caught) {
593
fail(ex.getName() + " not thrown", b);
594
}
595
}
596
597
private static void tryCatch(double[] t, Class<?> ex, Runnable thunk) {
598
tryCatch(DoubleBuffer.wrap(t), ex, thunk);
599
}
600
601
public static void test(int level, final DoubleBuffer b, boolean direct) {
602
603
show(level, b);
604
605
if (direct != b.isDirect())
606
fail("Wrong direction", b);
607
608
// Gets and puts
609
610
relPut(b);
611
relGet(b);
612
absGet(b);
613
bulkGet(b);
614
615
absPut(b);
616
relGet(b);
617
absGet(b);
618
bulkGet(b);
619
620
bulkPutArray(b);
621
relGet(b);
622
623
bulkPutBuffer(b);
624
relGet(b);
625
626
absBulkPutArray(b);
627
absBulkGet(b);
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
// Compact
666
667
relPut(b);
668
b.position(13);
669
b.compact();
670
b.flip();
671
relGet(b, 13);
672
673
// Exceptions
674
675
relPut(b);
676
b.limit(b.capacity() / 2);
677
b.position(b.limit());
678
679
tryCatch(b, BufferUnderflowException.class, () -> b.get());
680
tryCatch(b, BufferOverflowException.class, () -> b.put((double)42));
681
// The index must be non-negative and less than the buffer's limit.
682
catchIndexOutOfBounds(b, () -> b.get(b.limit()));
683
catchIndexOutOfBounds(b, () -> b.get(-1));
684
catchIndexOutOfBounds(b, () -> b.put(b.limit(), (double)42));
685
tryCatch(b, InvalidMarkException.class,
686
() -> b.position(0).mark().compact().reset());
687
688
try {
689
b.position(b.limit() + 1);
690
fail("IllegalArgumentException expected for position beyond limit");
691
} catch (IllegalArgumentException e) {
692
if (e.getMessage() == null) {
693
fail("Non-null IllegalArgumentException message expected for"
694
+ " position beyond limit");
695
}
696
}
697
698
try {
699
b.position(-1);
700
fail("IllegalArgumentException expected for negative position");
701
} catch (IllegalArgumentException e) {
702
if (e.getMessage() == null) {
703
fail("Non-null IllegalArgumentException message expected for"
704
+ " negative position");
705
}
706
}
707
708
try {
709
b.limit(b.capacity() + 1);
710
fail("IllegalArgumentException expected for limit beyond capacity");
711
} catch (IllegalArgumentException e) {
712
if (e.getMessage() == null) {
713
fail("Non-null IllegalArgumentException message expected for"
714
+ " limit beyond capacity");
715
}
716
}
717
718
try {
719
b.limit(-1);
720
fail("IllegalArgumentException expected for negative limit");
721
} catch (IllegalArgumentException e) {
722
if (e.getMessage() == null) {
723
fail("Non-null IllegalArgumentException message expected for"
724
+ " negative limit");
725
}
726
}
727
728
// Exceptions in absolute bulk and slice operations
729
730
catchNullArgument(b, () -> b.get(7, null, 0, 42));
731
catchNullArgument(b, () -> b.put(7, (double[])null, 0, 42));
732
733
double[] tmpa = new double[42];
734
catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
735
catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
736
catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
737
catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
738
catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
739
catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
740
741
catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
742
catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
743
catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
744
catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
745
catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
746
catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
747
748
catchIndexOutOfBounds(b, () -> b.slice(-1, 7));
749
catchIndexOutOfBounds(b, () -> b.slice(b.limit() + 1, 7));
750
catchIndexOutOfBounds(b, () -> b.slice(0, -1));
751
catchIndexOutOfBounds(b, () -> b.slice(7, b.limit() - 7 + 1));
752
753
// Values
754
755
b.clear();
756
b.put((double)0);
757
b.put((double)-1);
758
b.put((double)1);
759
b.put(Double.MAX_VALUE);
760
b.put(Double.MIN_VALUE);
761
762
763
764
765
766
767
768
769
770
b.put(-Double.MAX_VALUE);
771
b.put(-Double.MIN_VALUE);
772
b.put(Double.NEGATIVE_INFINITY);
773
b.put(Double.POSITIVE_INFINITY);
774
b.put(Double.NaN);
775
b.put(0.5121609353879392); // Changes value if incorrectly swapped
776
777
778
b.flip();
779
ck(b, b.get(), 0);
780
ck(b, b.get(), (double)-1);
781
ck(b, b.get(), 1);
782
ck(b, b.get(), Double.MAX_VALUE);
783
ck(b, b.get(), Double.MIN_VALUE);
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
double v;
799
ck(b, b.get(), -Double.MAX_VALUE);
800
ck(b, b.get(), -Double.MIN_VALUE);
801
ck(b, b.get(), Double.NEGATIVE_INFINITY);
802
ck(b, b.get(), Double.POSITIVE_INFINITY);
803
if (Double.doubleToRawLongBits(v = b.get())
804
!= Double.doubleToRawLongBits(Double.NaN)) {
805
fail(b, (long)Double.NaN, (long)v);
806
}
807
ck(b, b.get(), 0.5121609353879392);
808
809
810
811
// Comparison
812
b.rewind();
813
DoubleBuffer b2 = DoubleBuffer.allocate(b.capacity());
814
b2.put(b);
815
b2.flip();
816
b.position(2);
817
b2.position(2);
818
if (!b.equals(b2)) {
819
for (int i = 2; i < b.limit(); i++) {
820
double x = b.get(i);
821
double y = b2.get(i);
822
if (x != y
823
824
|| Double.compare(x, y) != 0
825
826
827
828
829
) {
830
out.println("[" + i + "] " + x + " != " + y);
831
}
832
}
833
fail("Identical buffers not equal", b, b2);
834
}
835
if (b.compareTo(b2) != 0) {
836
fail("Comparison to identical buffer != 0", b, b2);
837
}
838
b.limit(b.limit() + 1);
839
b.position(b.limit() - 1);
840
b.put((double)99);
841
b.rewind();
842
b2.rewind();
843
if (b.equals(b2))
844
fail("Non-identical buffers equal", b, b2);
845
if (b.compareTo(b2) <= 0)
846
fail("Comparison to shorter buffer <= 0", b, b2);
847
b.limit(b.limit() - 1);
848
849
b.put(2, (double)42);
850
if (b.equals(b2))
851
fail("Non-identical buffers equal", b, b2);
852
if (b.compareTo(b2) <= 0)
853
fail("Comparison to lesser buffer <= 0", b, b2);
854
855
// Check equals and compareTo with interesting values
856
for (double x : VALUES) {
857
DoubleBuffer xb = DoubleBuffer.wrap(new double[] { x });
858
if (xb.compareTo(xb) != 0) {
859
fail("compareTo not reflexive", xb, xb, x, x);
860
}
861
if (!xb.equals(xb)) {
862
fail("equals not reflexive", xb, xb, x, x);
863
}
864
for (double y : VALUES) {
865
DoubleBuffer yb = DoubleBuffer.wrap(new double[] { y });
866
if (xb.compareTo(yb) != - yb.compareTo(xb)) {
867
fail("compareTo not anti-symmetric",
868
xb, yb, x, y);
869
}
870
if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
871
fail("compareTo inconsistent with equals",
872
xb, yb, x, y);
873
}
874
if (xb.compareTo(yb) != Double.compare(x, y)) {
875
876
877
878
879
if (x == 0.0 && y == 0.0) continue;
880
881
fail("Incorrect results for DoubleBuffer.compareTo",
882
xb, yb, x, y);
883
}
884
if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
885
fail("Incorrect results for DoubleBuffer.equals",
886
xb, yb, x, y);
887
}
888
}
889
}
890
891
// Sub, dup
892
893
relPut(b);
894
relGet(b.duplicate());
895
b.position(13);
896
relGet(b.duplicate(), 13);
897
relGet(b.duplicate().slice(), 13);
898
relGet(b.slice(), 13);
899
relGet(b.slice().duplicate(), 13);
900
901
// Slice
902
903
b.position(5);
904
DoubleBuffer sb = b.slice();
905
checkSlice(b, sb);
906
b.position(0);
907
DoubleBuffer sb2 = sb.slice();
908
checkSlice(sb, sb2);
909
910
if (!sb.equals(sb2))
911
fail("Sliced slices do not match", sb, sb2);
912
if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) {
913
fail("Array offsets do not match: "
914
+ sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2);
915
}
916
917
int bPos = b.position();
918
int bLim = b.limit();
919
920
b.position(7);
921
b.limit(42);
922
DoubleBuffer rsb = b.slice();
923
b.position(0);
924
b.limit(b.capacity());
925
DoubleBuffer asb = b.slice(7, 35);
926
checkSlice(rsb, asb);
927
928
b.position(bPos);
929
b.limit(bLim);
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
// Read-only views
963
964
b.rewind();
965
final DoubleBuffer rb = b.asReadOnlyBuffer();
966
if (!b.equals(rb))
967
fail("Buffer not equal to read-only view", b, rb);
968
show(level + 1, rb);
969
970
catchReadOnlyBuffer(b, () -> relPut(rb));
971
catchReadOnlyBuffer(b, () -> absPut(rb));
972
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
973
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
974
catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
975
976
// put(DoubleBuffer) should not change source position
977
final DoubleBuffer src = DoubleBuffer.allocate(1);
978
catchReadOnlyBuffer(b, () -> rb.put(src));
979
ck(src, src.position(), 0);
980
981
catchReadOnlyBuffer(b, () -> rb.compact());
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
if (rb.getClass().getName().startsWith("java.nio.Heap")) {
1009
catchReadOnlyBuffer(b, () -> rb.array());
1010
catchReadOnlyBuffer(b, () -> rb.arrayOffset());
1011
if (rb.hasArray()) {
1012
fail("Read-only heap buffer's backing array is accessible", rb);
1013
}
1014
}
1015
1016
// Bulk puts from read-only buffers
1017
1018
b.clear();
1019
rb.rewind();
1020
b.put(rb);
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
relPut(b); // Required by testViews
1033
1034
1035
1036
1037
1038
1039
}
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
public static void test(final double [] ba) {
1092
int offset = 47;
1093
int length = 900;
1094
final DoubleBuffer b = DoubleBuffer.wrap(ba, offset, length);
1095
show(0, b);
1096
ck(b, b.capacity(), ba.length);
1097
ck(b, b.position(), offset);
1098
ck(b, b.limit(), offset + length);
1099
1100
// The offset must be non-negative and no larger than <array.length>.
1101
catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, -1, ba.length));
1102
catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, ba.length + 1, ba.length));
1103
catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, 0, -1));
1104
catchIndexOutOfBounds(ba, () -> DoubleBuffer.wrap(ba, 0, ba.length + 1));
1105
1106
// A NullPointerException will be thrown if the array is null.
1107
tryCatch(ba, NullPointerException.class,
1108
() -> DoubleBuffer.wrap((double []) null, 0, 5));
1109
tryCatch(ba, NullPointerException.class,
1110
() -> DoubleBuffer.wrap((double []) null));
1111
}
1112
1113
private static void testAllocate() {
1114
// An IllegalArgumentException will be thrown for negative capacities.
1115
catchIllegalArgument((Buffer) null, () -> DoubleBuffer.allocate(-1));
1116
try {
1117
DoubleBuffer.allocate(-1);
1118
} catch (IllegalArgumentException e) {
1119
if (e.getMessage() == null) {
1120
fail("Non-null IllegalArgumentException message expected for"
1121
+ " attempt to allocate negative capacity buffer");
1122
}
1123
}
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
}
1136
1137
public static void testToString() {
1138
final int cap = 10;
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
DoubleBuffer nondirect1 = DoubleBuffer.allocate(cap);
1150
if (!nondirect1.toString().equals(Basic.toString(nondirect1))) {
1151
fail("Heap buffer toString is incorrect: "
1152
+ nondirect1.toString() + " vs " + Basic.toString(nondirect1));
1153
}
1154
1155
}
1156
1157
public static void test() {
1158
testAllocate();
1159
test(0, DoubleBuffer.allocate(7 * 1024), false);
1160
test(0, DoubleBuffer.wrap(new double[7 * 1024], 0, 7 * 1024), false);
1161
test(new double[1024]);
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
callReset(DoubleBuffer.allocate(10));
1173
1174
1175
1176
putBuffer();
1177
1178
1179
testToString();
1180
}
1181
1182
}
1183
1184