1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T5.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,104 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics 1.9 + * 1.10 + * @path ch11/11.5/11.5.3/S11.5.3_A4_T5.js 1.11 + * @description If dividend is finite and the divisor is an infinity, the result equals the dividend 1.12 + */ 1.13 + 1.14 +//CHECK#1 1.15 +if (1 % Number.NEGATIVE_INFINITY !== 1) { 1.16 + $ERROR('#1: 1 % -Infinity === 1. Actual: ' + (1 % -Infinity)); 1.17 +} 1.18 +//CHECK#2 1.19 +if (1 % Number.POSITIVE_INFINITY !==1) { 1.20 + $ERROR('#2: 1 % Infinity === 1. Actual: ' + (1 % Infinity)); 1.21 +} 1.22 + 1.23 +//CHECK#3 1.24 +if (-1 % Number.POSITIVE_INFINITY !== -1) { 1.25 + $ERROR('#3: -1 % Infinity === -1. Actual: ' + (-1 % Infinity)); 1.26 +} 1.27 + 1.28 +//CHECK#4 1.29 +if (-1 % Number.NEGATIVE_INFINITY !== -1) { 1.30 + $ERROR('#4: -1 % -Infinity === -1. Actual: ' + (-1 % -Infinity)); 1.31 +} 1.32 + 1.33 +//CHECK#5 1.34 +if (0 % Number.POSITIVE_INFINITY !== 0) { 1.35 + $ERROR('#5.1: 0 % Infinity === 0. Actual: ' + (0 % Infinity)); 1.36 +} else { 1.37 + if (1 / (0 % Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { 1.38 + $ERROR('#5.2: 0 % Infinity === + 0. Actual: -0'); 1.39 + } 1.40 +} 1.41 + 1.42 +//CHECK#6 1.43 +if (0 % Number.NEGATIVE_INFINITY !== 0) { 1.44 + $ERROR('#6.1: 0 % -Infinity === 0. Actual: ' + (0 % -Infinity)); 1.45 +} else { 1.46 + if (1 / (0 % Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { 1.47 + $ERROR('#6.2: 0 % -Infinity === + 0. Actual: -0'); 1.48 + } 1.49 +} 1.50 + 1.51 +//CHECK#7 1.52 +if (-0 % Number.POSITIVE_INFINITY !== -0) { 1.53 + $ERROR('#7.1: -0 % Infinity === 0. Actual: ' + (-0 % Infinity)); 1.54 +} else { 1.55 + if (1 / (-0 % Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { 1.56 + $ERROR('#7.2: -0 % Infinity === - 0. Actual: +0'); 1.57 + } 1.58 +} 1.59 + 1.60 +//CHECK#8 1.61 +if (-0 % Number.NEGATIVE_INFINITY !== -0) { 1.62 + $ERROR('#8.1: -0 % -Infinity === 0. Actual: ' + (-0 % -Infinity)); 1.63 +} else { 1.64 + if (1 / (-0 % Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { 1.65 + $ERROR('#8.2: -0 % -Infinity === - 0. Actual: +0'); 1.66 + } 1.67 +} 1.68 + 1.69 +//CHECK#9 1.70 +if (Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== Number.MAX_VALUE) { 1.71 + $ERROR('#9: Number.MAX_VALUE % -Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % -Infinity)); 1.72 +} 1.73 + 1.74 +//CHECK#10 1.75 +if (Number.MAX_VALUE % Number.POSITIVE_INFINITY !== Number.MAX_VALUE) { 1.76 + $ERROR('#10: Number.MAX_VALUE % Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % Infinity)); 1.77 +} 1.78 + 1.79 +//CHECK#11 1.80 +if (-Number.MAX_VALUE % Number.POSITIVE_INFINITY !== -Number.MAX_VALUE) { 1.81 + $ERROR('#11: -Number.MAX_VALUE % Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % Infinity)); 1.82 +} 1.83 + 1.84 +//CHECK#12 1.85 +if (-Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== -Number.MAX_VALUE) { 1.86 + $ERROR('#12: -Number.MAX_VALUE % -Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % -Infinity)); 1.87 +} 1.88 + 1.89 +//CHECK#13 1.90 +if (Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== Number.MIN_VALUE) { 1.91 + $ERROR('#13: Number.MIN_VALUE % -Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % -Infinity)); 1.92 +} 1.93 +//CHECK#14 1.94 +if (Number.MIN_VALUE % Number.POSITIVE_INFINITY !== Number.MIN_VALUE) { 1.95 + $ERROR('#14: Number.MIN_VALUE % Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % Infinity)); 1.96 +} 1.97 + 1.98 +//CHECK#15 1.99 +if (-Number.MIN_VALUE % Number.POSITIVE_INFINITY !== -Number.MIN_VALUE) { 1.100 + $ERROR('#15: -Number.MIN_VALUE % Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % Infinity)); 1.101 +} 1.102 + 1.103 +//CHECK#16 1.104 +if (-Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== -Number.MIN_VALUE) { 1.105 + $ERROR('#16: -Number.MIN_VALUE % -Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % -Infinity)); 1.106 +} 1.107 +