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 0000000000000000000000000000000000000000..f86b630dfd1a7c9ca9ceb4ff93e499f09699d883 --- /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 0000000000000000000000000000000000000000..55fe4332d1435c7430d176b932eaac901b0ab3be --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0027-convert/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(convert) +run(convert)