646 fail("Non-null IllegalArgumentException message expected for" |
646 fail("Non-null IllegalArgumentException message expected for" |
647 + " negative limit"); |
647 + " negative limit"); |
648 } |
648 } |
649 } |
649 } |
650 |
650 |
651 // Exceptions in absolute bulk operations |
651 // Exceptions in absolute bulk and slice operations |
652 |
652 |
653 catchNullArgument(b, () -> b.get(7, null, 0, 42)); |
653 catchNullArgument(b, () -> b.get(7, null, 0, 42)); |
654 catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42)); |
654 catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42)); |
655 |
655 |
656 $type$[] tmpa = new $type$[42]; |
656 $type$[] tmpa = new $type$[42]; |
665 catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); |
665 catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); |
666 catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); |
666 catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); |
667 catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); |
667 catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); |
668 catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); |
668 catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); |
669 catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); |
669 catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); |
|
670 |
|
671 catchIndexOutOfBounds(b, () -> b.slice(-1, 7)); |
|
672 catchIndexOutOfBounds(b, () -> b.slice(b.limit() + 1, 7)); |
|
673 catchIndexOutOfBounds(b, () -> b.slice(0, -1)); |
|
674 catchIndexOutOfBounds(b, () -> b.slice(7, b.limit() - 7 + 1)); |
670 |
675 |
671 // Values |
676 // Values |
672 |
677 |
673 b.clear(); |
678 b.clear(); |
674 b.put(($type$)0); |
679 b.put(($type$)0); |
830 if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) { |
835 if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) { |
831 fail("Array offsets do not match: " |
836 fail("Array offsets do not match: " |
832 + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2); |
837 + sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2); |
833 } |
838 } |
834 |
839 |
|
840 int bPos = b.position(); |
|
841 int bLim = b.limit(); |
|
842 |
|
843 b.position(7); |
|
844 b.limit(42); |
|
845 $Type$Buffer rsb = b.slice(); |
|
846 b.position(0); |
|
847 b.limit(b.capacity()); |
|
848 $Type$Buffer asb = b.slice(7, 35); |
|
849 checkSlice(rsb, asb); |
|
850 |
|
851 b.position(bPos); |
|
852 b.limit(bLim); |
|
853 |
835 #if[byte] |
854 #if[byte] |
836 |
855 |
837 // Views |
856 // Views |
838 |
857 |
839 b.clear(); |
858 b.clear(); |