From 4aea52a5b90dced19ebe113665166187ae677c05 Mon Sep 17 00:00:00 2001 From: William Chen Date: Wed, 31 Mar 2021 14:12:36 -0700 Subject: [PATCH] Add sanity_test convert.c --- .../sanity_test/SANITY0027-convert/convert.c | 44 +++++++++++++++++++ .../sanity_test/SANITY0027-convert/test.cfg | 3 ++ 2 files changed, 47 insertions(+) create mode 100644 testsuite/c_test/sanity_test/SANITY0027-convert/convert.c create mode 100644 testsuite/c_test/sanity_test/SANITY0027-convert/test.cfg diff --git a/testsuite/c_test/sanity_test/SANITY0027-convert/convert.c b/testsuite/c_test/sanity_test/SANITY0027-convert/convert.c new file mode 100644 index 0000000000..f86b630dfd --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0027-convert/convert.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include +#include + +char c = 0xff; +unsigned char uc = 0xff; +short s; +int i; +long long l; + +int main() +{ + s = c; + i = s; + l = i; + //printf("signed = %ld ", l); + if (l != -1) { + abort(); + } + + s = uc; + i = s; + l = i; + //printf("unsigned = %ld\n", l); + if (l != 255) { + abort(); + } + + return 0; +} diff --git a/testsuite/c_test/sanity_test/SANITY0027-convert/test.cfg b/testsuite/c_test/sanity_test/SANITY0027-convert/test.cfg new file mode 100644 index 0000000000..55fe4332d1 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0027-convert/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(convert) +run(convert) -- Gitee