mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 10:05:19 +00:00
Updated tests for constant expressions.
am: 467bb282d2
Change-Id: Ife9919731add41f62b9555325a1d343ab9f2bd2b
This commit is contained in:
@@ -25,6 +25,25 @@ $(GEN): $(LOCAL_PATH)/IExpression.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IExpressionExt.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/expression/1.0/ExpressionExtAll.cpp
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IExpressionExt.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IExpression.hal
|
||||
$(GEN): $(LOCAL_PATH)/IExpression.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Lc++ -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.expression@1.0::IExpressionExt
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IExpressionExt.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libhidl \
|
||||
@@ -61,6 +80,25 @@ $(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(GEN): $(LOCAL_PATH)/IExpression.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IExpressionExt.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/expression/1.0/IExpressionExt.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IExpressionExt.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IExpression.hal
|
||||
$(GEN): $(LOCAL_PATH)/IExpression.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.expression@1.0::IExpressionExt
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IExpressionExt.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
|
||||
|
||||
@@ -144,4 +144,54 @@ interface IExpression {
|
||||
logand4 = (0 && 1) == 0,
|
||||
};
|
||||
|
||||
enum Grayscale : int8_t {
|
||||
WHITE = 126,
|
||||
GRAY, // 127
|
||||
DARK_GRAY, // -128
|
||||
BLACK // -127
|
||||
};
|
||||
|
||||
enum Color : Grayscale {
|
||||
RED, // -126
|
||||
RUBY = 0,
|
||||
GREEN, // 1
|
||||
BLUE = 5,
|
||||
CYAN, // 6
|
||||
ORANGE, // 7
|
||||
ROSE = WHITE,
|
||||
};
|
||||
|
||||
enum Foo1 : int8_t {};
|
||||
enum Foo2 : Foo1 {};
|
||||
enum Foo3 : Foo2 {
|
||||
BAR1, // 0
|
||||
BAR2 = 10,
|
||||
};
|
||||
enum Foo4 : Foo3 {
|
||||
BAR3, // 11
|
||||
BAR4 = BAR2 + BAR3 // 21
|
||||
};
|
||||
|
||||
enum Number : uint8_t {
|
||||
MAX = 255,
|
||||
MAX_PLUS_1, // 0
|
||||
MAX_PLUS_2 // 1
|
||||
};
|
||||
|
||||
enum Constants {
|
||||
CONST_FOO,
|
||||
CONST_BAR = 70,
|
||||
MAX_ARRAY_SIZE = 20,
|
||||
MAX_ARRAY_SIZE2,
|
||||
MAX_ARRAY_SIZE3 = MAX_ARRAY_SIZE + MAX_ARRAY_SIZE,
|
||||
MY_INT32_MAX_MINUS_1 = 0x7FFFFFFE,
|
||||
MY_INT32_MAX, // 0x7FFFFFFF
|
||||
MY_INT32_MIN, // 0x80000000
|
||||
MY_INT32_MIN_PLUS_1, // 0x80000001
|
||||
};
|
||||
|
||||
@callflow(key=Constants:CONST_FOO + 1)
|
||||
foo1(int32_t[Constants:CONST_FOO + 1] array);
|
||||
foo2(int32_t[5 + 8] array);
|
||||
foo3(int32_t[Constants:MAX_ARRAY_SIZE] array);
|
||||
};
|
||||
|
||||
40
tests/expression/1.0/IExpressionExt.hal
Normal file
40
tests/expression/1.0/IExpressionExt.hal
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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 android.hardware.tests.expression@1.0;
|
||||
|
||||
import IExpression;
|
||||
|
||||
interface IExpressionExt {
|
||||
|
||||
enum NewEnum : int32_t {
|
||||
ENUM_GOOD = Constants:CONST_BAR,
|
||||
ENUM_BETTER = IExpression.Constants:CONST_BAR,
|
||||
ENUM_BEST = android.hardware.tests.expression@1.0::IExpression.Constants:CONST_BAR,
|
||||
};
|
||||
|
||||
typedef Color[((Constants:MAX_ARRAY_SIZE << 1) - (Constants:CONST_FOO + 1)*8) >> 1] SixteenColors;
|
||||
struct ArrayOfColors {
|
||||
Color[(Constants:MAX_ARRAY_SIZE << 1) - (Constants:CONST_FOO + 1)*8] my32Colors; // 32
|
||||
};
|
||||
struct AnotherArrayOfColors {
|
||||
SixteenColors my16Colors;
|
||||
};
|
||||
|
||||
foo3(int32_t[IExpression.Constants:MAX_ARRAY_SIZE] array);
|
||||
foo2(SixteenColors array);
|
||||
foo1(int32_t[Constants:CONST_FOO + 5] array);
|
||||
};
|
||||
Reference in New Issue
Block a user