blob: b340b6090a8144fd67fa975275b33014393eb15d (
plain) (
tree)
|
|
// %CopyrightBegin%
//
// Copyright Ericsson AB 1997-2010. All Rights Reserved.
//
// 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.
//
// %CopyrightEnd%
//
// Check normal values and expressions for constants
//
// Integer types
const long co1 = 077;
const long ch1 = 0xf1;
const long ch2 = 0XAB;
const long c1 = 1;
const short c2 = 3;
const unsigned long c3 = 1;
const unsigned short c4 = 3;
// Unary ops
const long c1hb = -0x1;
const long c1b = -1;
const short c2b = -3;
const long c1c = +1;
const short c2c = +3;
// ~ not supported
// Check binary ops
const long c1d = 9+1-3;
const long c1hd = 9+1-0xf3;
const short c2d = 7+3;
const short c2e = 7*3;
const long c1e = 1 | 7;
const long c1f = 7 & 9;
const long c1g = (1 | 7) & 9;
const long c1h = 1^7;
//floats
const float c5 = 1.9;
const double c6 = 1.9;
const float c5b = -1.9;
const double c6b = -1.9;
// Check type operand casting
const float c5c = 1/(9+2) * 2;
const double c6c = 1.9-1;
//const double c6d = 1; // Does not work yet
// Booleans and expressions
const boolean c7 = TRUE;
const boolean c7b = FALSE;
const boolean c7c = TRUE | FALSE;
const boolean c7d = TRUE & FALSE;
const boolean c7e = TRUE&TRUE | FALSE&TRUE;
const boolean c7f = TRUE&TRUE ^ FALSE&TRUE;
// Character and string
const char c8 = 'c';
const char c8b = '\n';
const string c9 = "hej";
const string<9> c9b = "hejdu";
//
// Check that value references work
//
const long rc1 = c1g;
const long rc1h = c1h + 9;
const short rc2 = c2;
const unsigned long rc3 = c3;
const unsigned short rc4 = c4;
const float rc5c = c5c;
const double rc6c = c6c;
const double rc6d = c6c+1.3;
const boolean rc7 = c7;
const boolean rc7c = c7c | TRUE;
const char rc8 = c8;
const char rc8b = c8b;
const string rc9 = c9;
const string<9> rc9b = c9b;
//
// Now check that all typerefs work
//
typedef long longT;
typedef short shortT;
typedef unsigned long ulongT;
typedef unsigned short ushortT;
typedef float floatT;
typedef double doubleT;
typedef char charT;
typedef string stringT;
typedef boolean booleanT;
const longT cc1 = 1;
const shortT cc2 = 3;
const ::longT cc1b = -1;
const ::shortT cc2b = -3;
const floatT cc5 = 1.9;
const doubleT cc6 = 1.9;
const floatT cc5b = -1.9;
const doubleT cc6b = -1.9;
const floatT cc5c = 1/(9+2) * 2;
const doubleT cc6c = 1.9-1;
const booleanT cc7 = TRUE;
const booleanT cc7b = TRUE;
const booleanT cc7c = TRUE | FALSE;
const booleanT cc7d = TRUE & FALSE;
const booleanT cc7e = TRUE&TRUE | FALSE&TRUE;
const charT cc8 = 'c';
const charT cc8b = '\n';
const stringT cc9 = "hej";
const stringT cc9b = "hejdu";
//
// Check value casting
//
const long longC = -9;
const short shortC = -9;
const unsigned long ulongC = 1;
const unsigned short ushortC = 0;
const float floatC = 5.1;
const double doubleC = -2.111;
const long c20 = shortC;
const long c21 = ulongC;
const long c22 = ushortC;
const short c23 = ushortC;
const double c34 = floatC;
|