michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Empty string, 0, false are all equal (==) to each other, since they all evaluate to 0 michael@0: * michael@0: * @path ch08/8.4/S8.4_A8.js michael@0: * @description Compare empty string with undefined, null, 0 and false michael@0: */ michael@0: michael@0: var str=''; michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#1 michael@0: if (str == undefined){ michael@0: $ERROR('#1: Empty string and undefined are not equal (!=) to each other'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#2 michael@0: if (str == null){ michael@0: $ERROR('#1: Empty string and Null are not equal (!=) to each other'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#3 michael@0: if (str != 0){ michael@0: $ERROR('#3: Empty string and 0 are equal (==) to each other, since they all evaluate to 0'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#4 michael@0: if (str != false){ michael@0: $ERROR('#4: Empty string and false are equal (==) to each other, since they all evaluate to 0'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: