#! /usr/bin/perl -w # This file is part of ff3d - http://www.freefem.org/ff3d # Copyright (C) 2003 Laboratoire J.-L. Lions UPMC Paris # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # $Id: if.pl,v 1.1 2003/08/04 09:26:42 ArceneL Exp $ # Checking the "if" keyword. require 'check.ph'; Run(<< 'EOF'); if(true) cout << "true: ok\n"; else cout << "true: ko\n"; if(false) cout << "false: ko\n"; else cout << "false: ok\n"; if(!true) cout << "!true: ko\n"; else cout << "!true: ok\n"; if(true && true) cout << "true && true: ok\n"; else cout << "true && true: ko\n"; if(true && false) cout << "true && false: ko\n"; else cout << "true && false: ok\n"; if(true || false) cout << "true || false: ok\n"; else cout << "true || false: ko\n"; if(false || false) cout << "false || false: ko\n"; else cout << "false || false: ok\n"; if(3 < 4) cout << "3 < 4: ok\n"; else cout << "3 < 4: ko\n"; if(3 == 3) cout << "3 == 3: ok\n"; else cout << "3 == 3: ko\n"; if(3 <= 3) cout << "3 <= 3: ok\n"; else cout << "3 <= 3: ko\n"; if(4 > 3) cout << "4 > 3: ok\n"; else cout << "4 > 3: ko\n"; if(4 >= 3) cout << "4 >= 3: ok\n"; else cout << "4 >= 3: ko\n"; EOF LineCheck('true: ok'); LineCheck('false: ok'); LineCheck('!true: ok'); LineCheck('true && true: ok'); LineCheck('true && false: ok'); LineCheck('true || false: ok'); LineCheck('false || false: ok'); LineCheck('3 < 4: ok'); LineCheck('3 == 3: ok'); LineCheck('3 <= 3: ok'); LineCheck('4 > 3: ok'); LineCheck('4 >= 3: ok'); Report();