From 9083cf4b0014867aea9f86efd4d9d01726dad01c Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 19 May 2018 16:31:44 -0700 Subject: [PATCH] Test integer128 impls --- test_suite/tests/test_de.rs | 21 +++++++++++++++++++++ test_suite/tests/test_ser.rs | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/test_suite/tests/test_de.rs b/test_suite/tests/test_de.rs index a7eedba3f..6c1f3d82f 100644 --- a/test_suite/tests/test_de.rs +++ b/test_suite/tests/test_de.rs @@ -259,6 +259,27 @@ declare_tests! { 0f32 => &[Token::F32(0.)], 0f64 => &[Token::F64(0.)], } + test_small_int_to_128 { + 1i128 => &[Token::I8(1)], + 1i128 => &[Token::I16(1)], + 1i128 => &[Token::I32(1)], + 1i128 => &[Token::I64(1)], + + 1i128 => &[Token::U8(1)], + 1i128 => &[Token::U16(1)], + 1i128 => &[Token::U32(1)], + 1i128 => &[Token::U64(1)], + + 1u128 => &[Token::I8(1)], + 1u128 => &[Token::I16(1)], + 1u128 => &[Token::I32(1)], + 1u128 => &[Token::I64(1)], + + 1u128 => &[Token::U8(1)], + 1u128 => &[Token::U16(1)], + 1u128 => &[Token::U32(1)], + 1u128 => &[Token::U64(1)], + } test_char { 'a' => &[Token::Char('a')], 'a' => &[Token::Str("a")], diff --git a/test_suite/tests/test_ser.rs b/test_suite/tests/test_ser.rs index d677fe351..795d65f61 100644 --- a/test_suite/tests/test_ser.rs +++ b/test_suite/tests/test_ser.rs @@ -586,3 +586,10 @@ fn test_enum_skipped() { "the enum variant Enum::SkippedMap cannot be serialized", ); } + +#[test] +fn test_integer128() { + assert_ser_tokens_error(&1i128, &[], "i128 is not supported"); + + assert_ser_tokens_error(&1u128, &[], "u128 is not supported"); +}