tst.intops.d revision 2633:71bab08d24b2
118334Speter/* 2169689Skan * CDDL HEADER START 3169689Skan * 4169689Skan * The contents of this file are subject to the terms of the 518334Speter * Common Development and Distribution License (the "License"). 690075Sobrien * You may not use this file except in compliance with the License. 718334Speter * 890075Sobrien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 990075Sobrien * or http://www.opensolaris.org/os/licensing. 1090075Sobrien * See the License for the specific language governing permissions 1190075Sobrien * and limitations under the License. 1218334Speter * 1390075Sobrien * When distributing Covered Code, include this CDDL HEADER in each 1490075Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1590075Sobrien * If applicable, add the following below this CDDL HEADER, with the 1690075Sobrien * fields enclosed by brackets "[]" replaced with your own identifying 1718334Speter * information: Portions Copyright [yyyy] [name of copyright owner] 1818334Speter * 1990075Sobrien * CDDL HEADER END 20169689Skan */ 21169689Skan 2218334Speter/* 2318334Speter * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2418334Speter * Use is subject to license terms. 2518334Speter */ 2618334Speter 27169689Skan#pragma ident "%Z%%M% %I% %E% SMI" 2818334Speter 2918334Speter/* 3050397Sobrien * ASSERTION: 31132718Skan * Verify relational operators with integers 32132718Skan * 3390075Sobrien * SECTION: Types, Operators, and Expressions/Relational Operators; 3418334Speter * Types, Operators, and Expressions/Precedence 35169689Skan * 3618334Speter */ 3790075Sobrien 3818334Speter#pragma D option quiet 3918334Speter 4050397Sobrien 4150397SobrienBEGIN 4252284Sobrien{ 4390075Sobrien int_1 = 0x100; 4490075Sobrien int_2 = 0x101; 45169689Skan int_3 = 0x99; 46169689Skan} 47169689Skan 4818334Spetertick-1 49169689Skan/int_1 >= int_2 || int_2 <= int_1 || int_1 == int_2/ 50169689Skan{ 51169689Skan printf("Shouldn't end up here (1)\n"); 52169689Skan printf("int_1 = %x int_2 = %x int_3 = %x\n", 53169689Skan (int) int_1, (int) int_2, (int) int_3); 54169689Skan exit(1); 55169689Skan} 56169689Skan 57169689Skantick-1 58169689Skan/int_3 > int_1 || int_1 < int_3 || int_3 == int_1/ 59169689Skan{ 60169689Skan printf("Shouldn't end up here (2)\n"); 61169689Skan printf("int_1 = %x int_2 = %x int_3 = %x\n", 62169689Skan (int) int_1, (int) int_2, (int) int_3); 63169689Skan exit(1); 64169689Skan} 65169689Skan 66169689Skantick-1 67169689Skan/int_2 > int_3 && int_1 < int_2 ^^ int_3 == int_2 && !(int_1 != int_2)/ 68169689Skan{ 69169689Skan exit(0); 70169689Skan} 7118334Speter