summaryrefslogtreecommitdiffstats
path: root/core/tests/coretests
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-06-13 16:55:54 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-06-13 17:20:20 +0900
commit62388936c88840a5f1ab7a7f6dd547467e99dfad (patch)
tree7ada4fd2bc0c39aa045e184af77b8febe80b60e3 /core/tests/coretests
parent63dd3bb3602bc00557680432b08b49a5a15bcdb7 (diff)
downloadframeworks_base-62388936c88840a5f1ab7a7f6dd547467e99dfad.zip
frameworks_base-62388936c88840a5f1ab7a7f6dd547467e99dfad.tar.gz
frameworks_base-62388936c88840a5f1ab7a7f6dd547467e99dfad.tar.bz2
Assert that RT_SCOPE_* and IFA_F_* are not zero.
If these constants are zero (or, rather, if they're not all different), the test will fail with more cryptic error messages whose cause is not obvious. Clearly check for that here. Bug: 15602893 Change-Id: I7ca4a9c5e3d592fd93fbfa1b50666a1861a0031d
Diffstat (limited to 'core/tests/coretests')
-rw-r--r--core/tests/coretests/src/android/net/LinkAddressTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/net/LinkAddressTest.java b/core/tests/coretests/src/android/net/LinkAddressTest.java
index 814ecdd..7bc3974 100644
--- a/core/tests/coretests/src/android/net/LinkAddressTest.java
+++ b/core/tests/coretests/src/android/net/LinkAddressTest.java
@@ -30,6 +30,7 @@ import java.util.List;
import android.net.LinkAddress;
import android.os.Parcel;
import android.test.AndroidTestCase;
+import static android.test.MoreAsserts.assertNotEqual;
import android.test.suitebuilder.annotation.SmallTest;
import static android.system.OsConstants.IFA_F_DEPRECATED;
@@ -50,6 +51,17 @@ public class LinkAddressTest extends AndroidTestCase {
private static final InetAddress V4_ADDRESS = NetworkUtils.numericToInetAddress(V4);
private static final InetAddress V6_ADDRESS = NetworkUtils.numericToInetAddress(V6);
+ public void testConstants() {
+ // RT_SCOPE_UNIVERSE = 0, but all the other constants should be nonzero.
+ assertNotEqual(0, RT_SCOPE_HOST);
+ assertNotEqual(0, RT_SCOPE_LINK);
+ assertNotEqual(0, RT_SCOPE_SITE);
+
+ assertNotEqual(0, IFA_F_DEPRECATED);
+ assertNotEqual(0, IFA_F_PERMANENT);
+ assertNotEqual(0, IFA_F_TENTATIVE);
+ }
+
public void testConstructors() throws SocketException {
LinkAddress address;