aboutsummaryrefslogtreecommitdiff
path: root/tests/rust/test_client.rs
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:04:25 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:04:25 +0000
commitf8a87fe5dbeef638581184663319c81d1515af72 (patch)
tree299efbccc7f71daa67253b5d436c4bcdfaeddf9e /tests/rust/test_client.rs
parentb4c7f74eef3a44858749ea3400412c7f258fe476 (diff)
parent1487d3a350538efd795d41e681242d363bdbc2f9 (diff)
downloadaidl-f8a87fe5dbeef638581184663319c81d1515af72.tar.gz
Change-Id: I655cd9c49b13842ed88061d7531ddca96cae68f6
Diffstat (limited to 'tests/rust/test_client.rs')
-rw-r--r--tests/rust/test_client.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/rust/test_client.rs b/tests/rust/test_client.rs
index 81315c9b..cd24eaea 100644
--- a/tests/rust/test_client.rs
+++ b/tests/rust/test_client.rs
@@ -121,6 +121,10 @@ fn test_constants() {
assert_eq!(ITestService::A55, 1);
assert_eq!(ITestService::A56, 1);
assert_eq!(ITestService::A57, 1);
+ assert_eq!(ITestService::FLOAT_TEST_CONSTANT4, 2.2_f32);
+ assert_eq!(ITestService::FLOAT_TEST_CONSTANT5, -2.2_f32);
+ assert_eq!(ITestService::DOUBLE_TEST_CONSTANT4, 2.2_f64);
+ assert_eq!(ITestService::DOUBLE_TEST_CONSTANT5, -2.2_f64);
}
#[test]
@@ -165,6 +169,20 @@ test_primitive! {test_primitive_long_constant, RepeatLong, ITestService::LONG_TE
test_primitive! {test_primitive_byte_enum, RepeatByteEnum, ByteEnum::FOO}
test_primitive! {test_primitive_int_enum, RepeatIntEnum, IntEnum::BAR}
test_primitive! {test_primitive_long_enum, RepeatLongEnum, LongEnum::FOO}
+test_primitive! {test_primitive_float_constant, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT}
+test_primitive! {test_primitive_float_constant2, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT2}
+test_primitive! {test_primitive_float_constant3, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT3}
+test_primitive! {test_primitive_float_constant4, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT4}
+test_primitive! {test_primitive_float_constant5, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT5}
+test_primitive! {test_primitive_float_constant6, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT6}
+test_primitive! {test_primitive_float_constant7, RepeatFloat, ITestService::FLOAT_TEST_CONSTANT7}
+test_primitive! {test_primitive_double_constant, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT}
+test_primitive! {test_primitive_double_constant2, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT2}
+test_primitive! {test_primitive_double_constant3, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT3}
+test_primitive! {test_primitive_double_constant4, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT4}
+test_primitive! {test_primitive_double_constant5, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT5}
+test_primitive! {test_primitive_double_constant6, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT6}
+test_primitive! {test_primitive_double_constant7, RepeatDouble, ITestService::DOUBLE_TEST_CONSTANT7}
#[test]
fn test_repeat_string() {
@@ -935,6 +953,17 @@ fn test_read_data_correctly_after_parcelable_with_new_field() {
assert_eq!(out_foo.intDefault42, 0);
}
+#[test]
+fn test_calling_v2_api_triggers_error() {
+ let service: binder::Strong<dyn IFooInterface::IFooInterface> =
+ binder::get_interface(<BpFooInterface as IFooInterface::IFooInterface>::get_descriptor())
+ .expect("did not get binder service");
+
+ let ret = service.newApi();
+
+ assert_eq!(ret.unwrap_err().transaction_error(), binder::StatusCode::UNKNOWN_TRANSACTION);
+}
+
fn test_renamed_interface<F>(f: F)
where
F: FnOnce(binder::Strong<dyn IOldName::IOldName>, binder::Strong<dyn INewName::INewName>),