1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 package com.android.tools.r8.utils; 5 6 import static org.junit.Assert.assertEquals; 7 8 import com.android.tools.r8.Resource; 9 import java.util.Collections; 10 import org.junit.Test; 11 12 public class OutputModeTest { 13 @Test testIndexedFileName()14 public void testIndexedFileName() { 15 assertEquals("classes.dex", OutputMode.Indexed.getOutputPath(null, 0)); 16 assertEquals("classes2.dex", OutputMode.Indexed.getOutputPath(null, 1)); 17 } 18 19 @Test testFilePerClass()20 public void testFilePerClass() { 21 Resource test = 22 Resource.fromBytes(Resource.Kind.CLASSFILE, new byte[]{}, Collections.singleton("LTest;")); 23 assertEquals("Test.dex", OutputMode.FilePerClass.getOutputPath(test, 0)); 24 Resource comTest = 25 Resource.fromBytes( 26 Resource.Kind.CLASSFILE, new byte[]{}, Collections.singleton("Lcom/Test;")); 27 assertEquals("com/Test.dex", OutputMode.FilePerClass.getOutputPath(comTest, 0)); 28 Resource comExampleTest = 29 Resource.fromBytes( 30 Resource.Kind.CLASSFILE, new byte[]{}, Collections.singleton("Lcom/example/Test;")); 31 assertEquals("com/example/Test.dex", OutputMode.FilePerClass.getOutputPath(comExampleTest, 0)); 32 assertEquals("com/example/Test.dex", OutputMode.FilePerClass.getOutputPath(comExampleTest, 1)); 33 } 34 } 35