Changeset 51
- Timestamp:
- 03/16/06 15:47:01 (3 years ago)
- Files:
-
- trunk/jsolait/lib/operators.js (modified) (3 diffs)
- trunk/jsolait/lib/testing.js (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/jsolait/lib/operators.js
r47 r51 55 55 return b.__eq__(a); 56 56 }else{ 57 return a== b;57 return a===b; 58 58 } 59 59 }; … … 65 65 return b.__ne__(a); 66 66 }else{ 67 return a != b;67 return a !== b; 68 68 } 69 69 }; … … 117 117 }; 118 118 119 120 Array.prototype.__eq__ = function(a){ 121 if(this.length != a.length){ 122 return false; 123 }else{ 124 for(var i=0;i<this.length;i++){ 125 if(! mod.eq(this[i], a[i])){ 126 return false; 127 } 128 } 129 return true; 130 } 131 }; 132 133 Array.prototype.__neq__ = function(a){ 134 if(this.length != a.length){ 135 return true; 136 }else{ 137 for(var i=0;i<this.length;i++){ 138 if(mod.neq(this[i], a[i])){ 139 return true; 140 } 141 } 142 return false; 143 } 144 }; 145 119 146 mod.__main__=function(){ 120 147 trunk/jsolait/lib/testing.js
r47 r51 168 168 169 169 if(value!==true){ 170 throw new mod.AssertFailed(comment, failMsg===undefined ? "Expected true but found: %s".format( value) : failMsg);170 throw new mod.AssertFailed(comment, failMsg===undefined ? "Expected true but found: %s".format(repr(value)) : failMsg); 171 171 } 172 172 }; … … 182 182 comment =''; 183 183 } 184 mod.assert(comment, value===true, "Expected true but found: %s".format( value));184 mod.assert(comment, value===true, "Expected true but found: %s".format(repr(value))); 185 185 }; 186 186 … … 195 195 comment =''; 196 196 } 197 mod.assert(comment, value===false, "Expected false but found: %s".format( value));197 mod.assert(comment, value===false, "Expected false but found: %s".format(repr(value))); 198 198 }; 199 199 … … 209 209 comment =''; 210 210 } 211 mod.assert(comment, ops.eq(value1, value2), "Expected %s == %s.".format(value1, value2));211 mod.assert(comment, ops.eq(value1, value2), "Expected %s === %s.".format(repr(value1), repr(value2))); 212 212 }; 213 213 … … 218 218 comment =''; 219 219 } 220 mod.assert(comment, ops.ne(value1, value2), "Expected %s != %s.".format(value1, value2));220 mod.assert(comment, ops.ne(value1, value2), "Expected %s !== %s.".format(repr(value1), repr(value2))); 221 221 }; 222 222 … … 227 227 comment =''; 228 228 } 229 mod.assert(comment, ops.is(value1, value2), "Expected %s === %s.".format( value1, value2));229 mod.assert(comment, ops.is(value1, value2), "Expected %s === %s.".format(repr(value1), repr(value2))); 230 230 }; 231 231 … … 236 236 comment =''; 237 237 } 238 mod.assert(comment, ops.isnot(value1, value2), "Expected %s !== %s.".format( value1, value2));238 mod.assert(comment, ops.isnot(value1, value2), "Expected %s !== %s.".format(repr(value1), repr(value2))); 239 239 }; 240 240 … … 244 244 comment =''; 245 245 } 246 mod.assert(comment, value===null, "Expected %s === null.".format( value));246 mod.assert(comment, value===null, "Expected %s === null.".format(repr(value))); 247 247 }; 248 248 … … 252 252 comment =''; 253 253 } 254 mod.assert(comment, value !==null, "Expected %s !== null.".format( value));254 mod.assert(comment, value !==null, "Expected %s !== null.".format(repr(value))); 255 255 }; 256 256 … … 260 260 comment =''; 261 261 } 262 mod.assert(comment, value===undefined, "Expected %s === undefined.".format( value));262 mod.assert(comment, value===undefined, "Expected %s === undefined.".format(repr(value))); 263 263 }; 264 264 … … 268 268 comment =''; 269 269 } 270 mod.assert(comment, value!==undefined, "Expected %s !== undefined".format( value));270 mod.assert(comment, value!==undefined, "Expected %s !== undefined".format(repr(value))); 271 271 }; 272 272 … … 276 276 comment =''; 277 277 } 278 mod.assert(comment, isNaN(value)===true, "Expected %s === NaN.".format( value));278 mod.assert(comment, isNaN(value)===true, "Expected %s === NaN.".format(repr(value))); 279 279 }; 280 280 … … 284 284 comment =''; 285 285 } 286 mod.assert(comment, isNaN(value)!==true, "Expected %s !== NaN".format( value));286 mod.assert(comment, isNaN(value)!==true, "Expected %s !== NaN".format(repr(value))); 287 287 }; 288 288
