Test for previous Math bug

- Bug fixed with CL 40360

Bug: 136717060
Change-Id: I31c120297e6d249124a0d1648ba50a319e0ce933
diff --git a/src/test/java/com/android/tools/r8/desugar/backports/LongBackportSingleMethodTest.java b/src/test/java/com/android/tools/r8/desugar/backports/LongBackportSingleMethodTest.java
new file mode 100644
index 0000000..1308f84
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/desugar/backports/LongBackportSingleMethodTest.java
@@ -0,0 +1,38 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.desugar.backports;
+
+import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.utils.AndroidApiLevel;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+// This test uses only parseUnsignedLongWithRadix and toUnsignedStringWithRadix, which call
+// divideUnsigned, but NOT divideUnsigned. D8 has to create a utility class for divideUnsigned, but
+// D8 can do that only once the previously created utility classes methods have been optimized.
+// This used to fail with the message "Missing utility class in the output"
+// (Missing utility class for divideUnsigned).
+@RunWith(Parameterized.class)
+public final class LongBackportSingleMethodTest extends AbstractBackportTest {
+
+  @Parameters(name = "{0}")
+  public static Iterable<?> data() {
+    return getTestParameters().withDexRuntimes().build();
+  }
+
+  public LongBackportSingleMethodTest(TestParameters parameters) {
+    super(parameters, Long.class, Main.class);
+    registerTarget(AndroidApiLevel.O, 10);
+  }
+
+  static final class Main extends MiniAssert {
+
+    public static void main(String[] args) {
+      assertTrue(Long.parseUnsignedLong("1234", 8) == 668);
+      assertTrue(Long.toUnsignedString(1234L, 8).equals("2322"));
+    }
+  }
+}