Remove bad test cases from MemoryFileTest.
Trying to mmap a region of length Integer.MAX_VALUE and
Integer.MIN_VALUE shoduln't be expected to work.
Also removes a couple of pointless comments.
bug: 13820294
Change-Id: I3d14ebc711f8a356f538e2593f7caa57f5a71bfc
diff --git a/tests/tests/os/src/android/os/cts/MemoryFileTest.java b/tests/tests/os/src/android/os/cts/MemoryFileTest.java
index 137f3c3..def73b2 100644
--- a/tests/tests/os/src/android/os/cts/MemoryFileTest.java
+++ b/tests/tests/os/src/android/os/cts/MemoryFileTest.java
@@ -33,13 +33,11 @@
}
public void testConstructor() throws IOException {
- // new the MemoryFile instance
new MemoryFile("Test File", 1024);
}
public void testWriteBytes() throws IOException {
byte[] data = new byte[512];
- // new the MemoryFile instance
mMemoryFile = new MemoryFile("Test File", 1024);
mMemoryFile.writeBytes(data, 0, 0, 512);
@@ -103,11 +101,14 @@
mMemoryFile = new MemoryFile("Test File", 512);
assertEquals(512, mMemoryFile.length());
- mMemoryFile = new MemoryFile("Test File", Integer.MAX_VALUE);
- assertEquals(Integer.MAX_VALUE, mMemoryFile.length());
+ mMemoryFile = new MemoryFile("Test File", 0);
+ assertEquals(0, mMemoryFile.length());
- mMemoryFile = new MemoryFile("Test File", Integer.MIN_VALUE);
- assertEquals(Integer.MIN_VALUE, mMemoryFile.length());
+ try {
+ mMemoryFile = new MemoryFile("Test File", -512);
+ fail();
+ } catch (IOException expected) {
+ }
}
public void testReadBytes() throws IOException {