diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java index 4e483322d1..a66dacd9d2 100644 --- a/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java +++ b/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java @@ -57,8 +57,8 @@ public class BpfDumpTest { @Test public void testToBase64EncodedString() { - final Struct.U32 key = new Struct.U32(TEST_KEY); - final Struct.U32 value = new Struct.U32(TEST_VAL); + final Struct.S32 key = new Struct.S32(TEST_KEY); + final Struct.S32 value = new Struct.S32(TEST_VAL); // Verified in python: // import base64 @@ -71,15 +71,15 @@ public class BpfDumpTest { @Test public void testFromBase64EncodedString() { - Pair decodedKeyValue = BpfDump.fromBase64EncodedString( - Struct.U32.class, Struct.U32.class, TEST_KEY_VAL_BASE64); + Pair decodedKeyValue = BpfDump.fromBase64EncodedString( + Struct.S32.class, Struct.S32.class, TEST_KEY_VAL_BASE64); assertEquals(TEST_KEY, decodedKeyValue.first.val); assertEquals(TEST_VAL, decodedKeyValue.second.val); } private void assertThrowsIllegalArgumentException(final String testStr) { assertThrows(IllegalArgumentException.class, - () -> BpfDump.fromBase64EncodedString(Struct.U32.class, Struct.U32.class, testStr)); + () -> BpfDump.fromBase64EncodedString(Struct.S32.class, Struct.S32.class, testStr)); } @Test @@ -96,7 +96,7 @@ public class BpfDumpTest { TEST_KEY_VAL_BASE64 + BASE64_DELIMITER + TEST_KEY_BASE64); } - private String getDumpMap(final IBpfMap map) { + private String getDumpMap(final IBpfMap map) { final StringWriter sw = new StringWriter(); BpfDump.dumpMap(map, new PrintWriter(sw), "mapName", "header", (key, val) -> "key=" + key.val + ", val=" + val.val); @@ -105,9 +105,9 @@ public class BpfDumpTest { @Test public void testDumpMap() throws Exception { - final IBpfMap map = - new TestBpfMap<>(Struct.U32.class, Struct.U32.class); - map.updateEntry(new Struct.U32(123), new Struct.U32(456)); + final IBpfMap map = + new TestBpfMap<>(Struct.S32.class, Struct.S32.class); + map.updateEntry(new Struct.S32(123), new Struct.S32(456)); final String dump = getDumpMap(map); assertEquals(dump, "mapName:\n" @@ -117,10 +117,10 @@ public class BpfDumpTest { @Test public void testDumpMapMultipleEntries() throws Exception { - final IBpfMap map = - new TestBpfMap<>(Struct.U32.class, Struct.U32.class); - map.updateEntry(new Struct.U32(123), new Struct.U32(456)); - map.updateEntry(new Struct.U32(789), new Struct.U32(123)); + final IBpfMap map = + new TestBpfMap<>(Struct.S32.class, Struct.S32.class); + map.updateEntry(new Struct.S32(123), new Struct.S32(456)); + map.updateEntry(new Struct.S32(789), new Struct.S32(123)); final String dump = getDumpMap(map); assertTrue(dump.contains("mapName:")); @@ -129,7 +129,7 @@ public class BpfDumpTest { assertTrue(dump.contains("key=789, val=123")); } - private String getDumpMapStatus(final IBpfMap map) { + private String getDumpMapStatus(final IBpfMap map) { final StringWriter sw = new StringWriter(); BpfDump.dumpMapStatus(map, new PrintWriter(sw), "mapName", "mapPath"); return sw.toString(); @@ -137,8 +137,8 @@ public class BpfDumpTest { @Test public void testGetMapStatus() { - final IBpfMap map = - new TestBpfMap<>(Struct.U32.class, Struct.U32.class); + final IBpfMap map = + new TestBpfMap<>(Struct.S32.class, Struct.S32.class); assertEquals("mapName: OK\n", getDumpMapStatus(map)); }