diff options
Diffstat (limited to 'jack-tests/tests/com/android/jack/enums/test003')
7 files changed, 238 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/enums/test003/dx/Tests.java b/jack-tests/tests/com/android/jack/enums/test003/dx/Tests.java new file mode 100644 index 0000000..47892a9 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/dx/Tests.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.dx; + + +import com.android.jack.enums.test003.jack.Data; +import com.android.jack.enums.test003.jack.Other; + +import org.junit.Assert; +import org.junit.Test; + +public class Tests { + + @Test + public void test1() { + Assert.assertEquals("ZERO", Data.get1()); + } + + @Test + public void test2() { + Assert.assertEquals("ZERO", Data.get2()); + } + + @Test + public void test3() { + Assert.assertEquals("ONE", Data.get3(Other.ONE)); + } + + @Test + public void test4() { + Assert.assertEquals("ONE", Data.get4()); + } +} diff --git a/jack-tests/tests/com/android/jack/enums/test003/jack/Data.java b/jack-tests/tests/com/android/jack/enums/test003/jack/Data.java new file mode 100644 index 0000000..277b827 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/jack/Data.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.jack; + +public class Data { + + public static String get1() { + for (Values a : Values.values()) { + switch (a) { + case ONE: + break; + case TWO: + break; + default: + return a.toString(); + } + } + + return "None"; + } + + public static String get2() { + for (Other a : Other.values()) { + switch (a) { + case ONE: + break; + case TWO: + break; + default: + return a.toString(); + } + } + + return "None"; + } + + public static String get3(Other a) { + switch (a) { + case ONE: + return "ONE"; + case TWO: + return "TWO"; + default: + return a.toString(); + } + } + + private static Other getEnumValue() { + return Other.ONE; + } + public static String get4() { + switch (getEnumValue()) { + case ONE: + return "ONE"; + case TWO: + return "TWO"; + default: + return "default"; + } + } +} diff --git a/jack-tests/tests/com/android/jack/enums/test003/jack/Other.java b/jack-tests/tests/com/android/jack/enums/test003/jack/Other.java new file mode 100644 index 0000000..f43b68a --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/jack/Other.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.jack; + +public enum Other { + ONE, + TWO +} diff --git a/jack-tests/tests/com/android/jack/enums/test003/jack/Values.java b/jack-tests/tests/com/android/jack/enums/test003/jack/Values.java new file mode 100644 index 0000000..0f8e773 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/jack/Values.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.jack; + +public enum Values { + ONE, + TWO +} diff --git a/jack-tests/tests/com/android/jack/enums/test003/link/Other.java b/jack-tests/tests/com/android/jack/enums/test003/link/Other.java new file mode 100644 index 0000000..bdf9371 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/link/Other.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.jack; + +public enum Other { + ZERO, + ONE, + TWO +}
\ No newline at end of file diff --git a/jack-tests/tests/com/android/jack/enums/test003/link/Values.java b/jack-tests/tests/com/android/jack/enums/test003/link/Values.java new file mode 100644 index 0000000..6e98691 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/link/Values.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.enums.test003.jack; + +public enum Values { + ZERO, + ONE, + TWO +} diff --git a/jack-tests/tests/com/android/jack/enums/test003/test.mk b/jack-tests/tests/com/android/jack/enums/test003/test.mk new file mode 100644 index 0000000..04e7a91 --- /dev/null +++ b/jack-tests/tests/com/android/jack/enums/test003/test.mk @@ -0,0 +1,26 @@ +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +private_path:= $(call my-dir) + +include $(JACK_CLEAR_VARS) + +JACKTEST_MODULE := enums/test003 +JACKTEST_WITHJACK_SRC := $(call all-java-files-under, $(abspath $(private_path)/jack/)) +JACKTEST_WITHDX_SRC := $(call all-java-files-under, $(abspath $(private_path)/dx/)) +JACKTEST_LINK_SRC := $(call all-java-files-under, $(abspath $(private_path)/link/)) +JACKTEST_JUNIT := com.android.jack.$(subst /,.,$(JACKTEST_MODULE)).dx.Tests +JACKTEST_DALVIK_FLAGS := -Xdexopt:none -Xverify:none + +include $(JACK_RUN_TEST) |