Browse Source

Kernel-Tests: add tests for invalid HEX numbers

Manfred Kroehnert 12 years ago
parent
commit
942045a62f
3 changed files with 310 additions and 0 deletions
  1. 133 0
      js/Kernel-Tests.deploy.js
  2. 132 0
      js/Kernel-Tests.js
  3. 45 0
      st/Kernel-Tests.st

+ 133 - 0
js/Kernel-Tests.deploy.js

@@ -1798,6 +1798,139 @@ return self}
 }),
 smalltalk.NumberTest);
 
+smalltalk.addMethod(
+"_testInvalidHexNumbers",
+smalltalk.method({
+selector: "testInvalidHexNumbers",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rG",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rg",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rH",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rh",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rI",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_ri",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rJ",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rj",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rK",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rk",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rL",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rl",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rM",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rm",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rN",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rn",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rO",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_ro",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rP",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rp",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rQ",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rq",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rR",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rr",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rS",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rs",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rT",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rt",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rU",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_ru",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rV",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rv",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rW",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rw",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rX",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rx",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rY",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_ry",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rZ",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((16),"_rz",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+smalltalk.send(self,"_should_raise_",[(function(){
+return smalltalk.send((11259375),"_Z",[]);
+}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
+return self}
+}),
+smalltalk.NumberTest);
+
 smalltalk.addMethod(
 "_testMinMax",
 smalltalk.method({

File diff suppressed because it is too large
+ 132 - 0
js/Kernel-Tests.js


+ 45 - 0
st/Kernel-Tests.st

@@ -954,6 +954,51 @@ testIdentity
 	self deny: 1 == 2
 !
 
+testInvalidHexNumbers
+
+	self should: [16rG] raise: MessageNotUnderstood.
+   	self should: [16rg] raise: MessageNotUnderstood.
+	self should: [16rH] raise: MessageNotUnderstood.
+   	self should: [16rh] raise: MessageNotUnderstood.
+	self should: [16rI] raise: MessageNotUnderstood.
+   	self should: [16ri] raise: MessageNotUnderstood.
+	self should: [16rJ] raise: MessageNotUnderstood.
+   	self should: [16rj] raise: MessageNotUnderstood.
+	self should: [16rK] raise: MessageNotUnderstood.
+   	self should: [16rk] raise: MessageNotUnderstood.
+	self should: [16rL] raise: MessageNotUnderstood.
+   	self should: [16rl] raise: MessageNotUnderstood.
+	self should: [16rM] raise: MessageNotUnderstood.
+   	self should: [16rm] raise: MessageNotUnderstood.
+	self should: [16rN] raise: MessageNotUnderstood.
+   	self should: [16rn] raise: MessageNotUnderstood.
+	self should: [16rO] raise: MessageNotUnderstood.
+   	self should: [16ro] raise: MessageNotUnderstood.
+	self should: [16rP] raise: MessageNotUnderstood.
+   	self should: [16rp] raise: MessageNotUnderstood.
+	self should: [16rQ] raise: MessageNotUnderstood.
+   	self should: [16rq] raise: MessageNotUnderstood.
+	self should: [16rR] raise: MessageNotUnderstood.
+   	self should: [16rr] raise: MessageNotUnderstood.
+	self should: [16rS] raise: MessageNotUnderstood.
+   	self should: [16rs] raise: MessageNotUnderstood.
+	self should: [16rT] raise: MessageNotUnderstood.
+   	self should: [16rt] raise: MessageNotUnderstood.
+	self should: [16rU] raise: MessageNotUnderstood.
+   	self should: [16ru] raise: MessageNotUnderstood.
+	self should: [16rV] raise: MessageNotUnderstood.
+   	self should: [16rv] raise: MessageNotUnderstood.
+	self should: [16rW] raise: MessageNotUnderstood.
+   	self should: [16rw] raise: MessageNotUnderstood.
+	self should: [16rX] raise: MessageNotUnderstood.
+   	self should: [16rx] raise: MessageNotUnderstood.
+	self should: [16rY] raise: MessageNotUnderstood.
+   	self should: [16ry] raise: MessageNotUnderstood.
+	self should: [16rZ] raise: MessageNotUnderstood.
+   	self should: [16rz] raise: MessageNotUnderstood.
+    self should: [16rABcdEfZ] raise: MessageNotUnderstood.
+!
+
 testMinMax
 	
 	self assert: (2 max: 5) equals: 5.

Some files were not shown because too many files changed in this diff