nudge 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +23 -0
- data/VERSION +1 -0
- data/_spikes/couch_document_spike.rb +24 -0
- data/_spikes/nested_parsing/nested.rb +0 -0
- data/_spikes/nested_parsing/nested.treetop +6 -0
- data/_spikes/nudgeview/init.rb +19 -0
- data/_spikes/nudgeview/public/javascripts/app.js +12 -0
- data/_spikes/nudgeview/public/javascripts/jquery.js +4376 -0
- data/_spikes/nudgeview/public/javascripts/jquery.svg.js +1325 -0
- data/_spikes/nudgeview/views/index.erb +18 -0
- data/_spikes/nudgeview/views/index.haml +8 -0
- data/_spikes/simplestWeb/simplest.rb +44 -0
- data/_spikes/simplestWeb/views/main.erb +19 -0
- data/_spikes/sketches/nudgecode_spike.rb +146 -0
- data/_spikes/sketches/searchDSL_spike.rb +25 -0
- data/_spikes/sketches/search_operator_sketch_spike.txt +287 -0
- data/_spikes/sketches/searchspace_spike.rb +96 -0
- data/_spikes/symbolic_regression/activate.rb +35 -0
- data/_spikes/symbolic_regression/config/environment.rb +340 -0
- data/_spikes/symbolic_regression/config/environments/deployment.rb +0 -0
- data/_spikes/symbolic_regression/config/environments/development.rb +0 -0
- data/_spikes/symbolic_regression/experiment/objectives/programLength.rb +2 -0
- data/_spikes/symbolic_regression/experiment/objectives/summedSquaredError.rb +2 -0
- data/_spikes/symbolic_regression/lib/tasks/run.rake +0 -0
- data/doc/classes/BlockNode.html +146 -0
- data/doc/classes/BlockNode.src/M000246.html +18 -0
- data/doc/classes/BoolAndInstruction.html +218 -0
- data/doc/classes/BoolAndInstruction.src/M000003.html +15 -0
- data/doc/classes/BoolAndInstruction.src/M000004.html +16 -0
- data/doc/classes/BoolAndInstruction.src/M000005.html +15 -0
- data/doc/classes/BoolAndInstruction.src/M000006.html +15 -0
- data/doc/classes/BoolEqualQInstruction.html +218 -0
- data/doc/classes/BoolEqualQInstruction.src/M000015.html +15 -0
- data/doc/classes/BoolEqualQInstruction.src/M000016.html +16 -0
- data/doc/classes/BoolEqualQInstruction.src/M000017.html +15 -0
- data/doc/classes/BoolEqualQInstruction.src/M000018.html +15 -0
- data/doc/classes/BoolFromFloatInstruction.html +218 -0
- data/doc/classes/BoolFromFloatInstruction.src/M000071.html +15 -0
- data/doc/classes/BoolFromFloatInstruction.src/M000072.html +15 -0
- data/doc/classes/BoolFromFloatInstruction.src/M000073.html +15 -0
- data/doc/classes/BoolFromFloatInstruction.src/M000074.html +15 -0
- data/doc/classes/BoolFromIntInstruction.html +218 -0
- data/doc/classes/BoolFromIntInstruction.src/M000067.html +15 -0
- data/doc/classes/BoolFromIntInstruction.src/M000068.html +15 -0
- data/doc/classes/BoolFromIntInstruction.src/M000069.html +15 -0
- data/doc/classes/BoolFromIntInstruction.src/M000070.html +15 -0
- data/doc/classes/BoolNotInstruction.html +218 -0
- data/doc/classes/BoolNotInstruction.src/M000019.html +15 -0
- data/doc/classes/BoolNotInstruction.src/M000020.html +15 -0
- data/doc/classes/BoolNotInstruction.src/M000021.html +15 -0
- data/doc/classes/BoolNotInstruction.src/M000022.html +15 -0
- data/doc/classes/BoolOrInstruction.html +218 -0
- data/doc/classes/BoolOrInstruction.src/M000007.html +15 -0
- data/doc/classes/BoolOrInstruction.src/M000008.html +16 -0
- data/doc/classes/BoolOrInstruction.src/M000009.html +15 -0
- data/doc/classes/BoolOrInstruction.src/M000010.html +15 -0
- data/doc/classes/BoolRandomInstruction.html +218 -0
- data/doc/classes/BoolRandomInstruction.src/M000187.html +15 -0
- data/doc/classes/BoolRandomInstruction.src/M000188.html +14 -0
- data/doc/classes/BoolRandomInstruction.src/M000189.html +15 -0
- data/doc/classes/BoolRandomInstruction.src/M000190.html +15 -0
- data/doc/classes/BoolType.html +196 -0
- data/doc/classes/BoolType.src/M000240.html +16 -0
- data/doc/classes/BoolType.src/M000241.html +15 -0
- data/doc/classes/BoolType.src/M000242.html +15 -0
- data/doc/classes/BoolXorInstruction.html +218 -0
- data/doc/classes/BoolXorInstruction.src/M000011.html +15 -0
- data/doc/classes/BoolXorInstruction.src/M000012.html +16 -0
- data/doc/classes/BoolXorInstruction.src/M000013.html +15 -0
- data/doc/classes/BoolXorInstruction.src/M000014.html +15 -0
- data/doc/classes/ChannelNode.html +161 -0
- data/doc/classes/ChannelNode.src/M000249.html +15 -0
- data/doc/classes/ChannelNode.src/M000250.html +16 -0
- data/doc/classes/CodeType.html +269 -0
- data/doc/classes/CodeType.src/M000219.html +38 -0
- data/doc/classes/CodeType.src/M000220.html +16 -0
- data/doc/classes/CodeType.src/M000221.html +16 -0
- data/doc/classes/CodeType.src/M000222.html +16 -0
- data/doc/classes/CodeType.src/M000223.html +24 -0
- data/doc/classes/CodeType.src/M000224.html +42 -0
- data/doc/classes/ERCNode.html +183 -0
- data/doc/classes/ERCNode.src/M000254.html +15 -0
- data/doc/classes/ERCNode.src/M000255.html +16 -0
- data/doc/classes/ERCNode.src/M000256.html +16 -0
- data/doc/classes/ExecPopInstruction.html +218 -0
- data/doc/classes/ExecPopInstruction.src/M000075.html +15 -0
- data/doc/classes/ExecPopInstruction.src/M000076.html +14 -0
- data/doc/classes/ExecPopInstruction.src/M000077.html +15 -0
- data/doc/classes/ExecPopInstruction.src/M000078.html +14 -0
- data/doc/classes/FloatAbsInstruction.html +218 -0
- data/doc/classes/FloatAbsInstruction.src/M000107.html +15 -0
- data/doc/classes/FloatAbsInstruction.src/M000108.html +15 -0
- data/doc/classes/FloatAbsInstruction.src/M000109.html +15 -0
- data/doc/classes/FloatAbsInstruction.src/M000110.html +15 -0
- data/doc/classes/FloatAddInstruction.html +218 -0
- data/doc/classes/FloatAddInstruction.src/M000079.html +15 -0
- data/doc/classes/FloatAddInstruction.src/M000080.html +16 -0
- data/doc/classes/FloatAddInstruction.src/M000081.html +15 -0
- data/doc/classes/FloatAddInstruction.src/M000082.html +15 -0
- data/doc/classes/FloatCosineInstruction.html +218 -0
- data/doc/classes/FloatCosineInstruction.src/M000123.html +15 -0
- data/doc/classes/FloatCosineInstruction.src/M000124.html +15 -0
- data/doc/classes/FloatCosineInstruction.src/M000125.html +15 -0
- data/doc/classes/FloatCosineInstruction.src/M000126.html +15 -0
- data/doc/classes/FloatDivideInstruction.html +218 -0
- data/doc/classes/FloatDivideInstruction.src/M000091.html +15 -0
- data/doc/classes/FloatDivideInstruction.src/M000092.html +16 -0
- data/doc/classes/FloatDivideInstruction.src/M000093.html +20 -0
- data/doc/classes/FloatDivideInstruction.src/M000094.html +15 -0
- data/doc/classes/FloatFromBoolInstruction.html +218 -0
- data/doc/classes/FloatFromBoolInstruction.src/M000055.html +15 -0
- data/doc/classes/FloatFromBoolInstruction.src/M000056.html +15 -0
- data/doc/classes/FloatFromBoolInstruction.src/M000057.html +15 -0
- data/doc/classes/FloatFromBoolInstruction.src/M000058.html +15 -0
- data/doc/classes/FloatFromIntInstruction.html +218 -0
- data/doc/classes/FloatFromIntInstruction.src/M000063.html +15 -0
- data/doc/classes/FloatFromIntInstruction.src/M000064.html +15 -0
- data/doc/classes/FloatFromIntInstruction.src/M000065.html +15 -0
- data/doc/classes/FloatFromIntInstruction.src/M000066.html +15 -0
- data/doc/classes/FloatGreaterThanQInstruction.html +218 -0
- data/doc/classes/FloatGreaterThanQInstruction.src/M000035.html +15 -0
- data/doc/classes/FloatGreaterThanQInstruction.src/M000036.html +16 -0
- data/doc/classes/FloatGreaterThanQInstruction.src/M000037.html +15 -0
- data/doc/classes/FloatGreaterThanQInstruction.src/M000038.html +15 -0
- data/doc/classes/FloatIfInstruction.html +218 -0
- data/doc/classes/FloatIfInstruction.src/M000047.html +16 -0
- data/doc/classes/FloatIfInstruction.src/M000048.html +15 -0
- data/doc/classes/FloatIfInstruction.src/M000049.html +14 -0
- data/doc/classes/FloatIfInstruction.src/M000050.html +17 -0
- data/doc/classes/FloatLessThanQInstruction.html +218 -0
- data/doc/classes/FloatLessThanQInstruction.src/M000039.html +15 -0
- data/doc/classes/FloatLessThanQInstruction.src/M000040.html +16 -0
- data/doc/classes/FloatLessThanQInstruction.src/M000041.html +15 -0
- data/doc/classes/FloatLessThanQInstruction.src/M000042.html +15 -0
- data/doc/classes/FloatMaxInstruction.html +218 -0
- data/doc/classes/FloatMaxInstruction.src/M000095.html +15 -0
- data/doc/classes/FloatMaxInstruction.src/M000096.html +16 -0
- data/doc/classes/FloatMaxInstruction.src/M000097.html +15 -0
- data/doc/classes/FloatMaxInstruction.src/M000098.html +15 -0
- data/doc/classes/FloatMinInstruction.html +218 -0
- data/doc/classes/FloatMinInstruction.src/M000099.html +15 -0
- data/doc/classes/FloatMinInstruction.src/M000100.html +16 -0
- data/doc/classes/FloatMinInstruction.src/M000101.html +15 -0
- data/doc/classes/FloatMinInstruction.src/M000102.html +15 -0
- data/doc/classes/FloatMultiplyInstruction.html +218 -0
- data/doc/classes/FloatMultiplyInstruction.src/M000083.html +15 -0
- data/doc/classes/FloatMultiplyInstruction.src/M000084.html +16 -0
- data/doc/classes/FloatMultiplyInstruction.src/M000085.html +15 -0
- data/doc/classes/FloatMultiplyInstruction.src/M000086.html +15 -0
- data/doc/classes/FloatNegativeInstruction.html +218 -0
- data/doc/classes/FloatNegativeInstruction.src/M000103.html +15 -0
- data/doc/classes/FloatNegativeInstruction.src/M000104.html +15 -0
- data/doc/classes/FloatNegativeInstruction.src/M000105.html +15 -0
- data/doc/classes/FloatNegativeInstruction.src/M000106.html +15 -0
- data/doc/classes/FloatPowerInstruction.html +218 -0
- data/doc/classes/FloatPowerInstruction.src/M000111.html +15 -0
- data/doc/classes/FloatPowerInstruction.src/M000112.html +16 -0
- data/doc/classes/FloatPowerInstruction.src/M000113.html +20 -0
- data/doc/classes/FloatPowerInstruction.src/M000114.html +15 -0
- data/doc/classes/FloatRandomInstruction.html +218 -0
- data/doc/classes/FloatRandomInstruction.src/M000191.html +15 -0
- data/doc/classes/FloatRandomInstruction.src/M000192.html +14 -0
- data/doc/classes/FloatRandomInstruction.src/M000193.html +15 -0
- data/doc/classes/FloatRandomInstruction.src/M000194.html +15 -0
- data/doc/classes/FloatSineInstruction.html +218 -0
- data/doc/classes/FloatSineInstruction.src/M000119.html +15 -0
- data/doc/classes/FloatSineInstruction.src/M000120.html +15 -0
- data/doc/classes/FloatSineInstruction.src/M000121.html +15 -0
- data/doc/classes/FloatSineInstruction.src/M000122.html +15 -0
- data/doc/classes/FloatSqrtInstruction.html +218 -0
- data/doc/classes/FloatSqrtInstruction.src/M000115.html +15 -0
- data/doc/classes/FloatSqrtInstruction.src/M000116.html +15 -0
- data/doc/classes/FloatSqrtInstruction.src/M000117.html +19 -0
- data/doc/classes/FloatSqrtInstruction.src/M000118.html +15 -0
- data/doc/classes/FloatSubtractInstruction.html +218 -0
- data/doc/classes/FloatSubtractInstruction.src/M000087.html +15 -0
- data/doc/classes/FloatSubtractInstruction.src/M000088.html +16 -0
- data/doc/classes/FloatSubtractInstruction.src/M000089.html +15 -0
- data/doc/classes/FloatSubtractInstruction.src/M000090.html +15 -0
- data/doc/classes/FloatTangentInstruction.html +218 -0
- data/doc/classes/FloatTangentInstruction.src/M000127.html +15 -0
- data/doc/classes/FloatTangentInstruction.src/M000128.html +15 -0
- data/doc/classes/FloatTangentInstruction.src/M000129.html +15 -0
- data/doc/classes/FloatTangentInstruction.src/M000130.html +15 -0
- data/doc/classes/FloatType.html +196 -0
- data/doc/classes/FloatType.src/M000243.html +19 -0
- data/doc/classes/FloatType.src/M000244.html +15 -0
- data/doc/classes/FloatType.src/M000245.html +15 -0
- data/doc/classes/Helpers.html +161 -0
- data/doc/classes/Helpers.src/M000343.html +21 -0
- data/doc/classes/Helpers.src/M000344.html +24 -0
- data/doc/classes/Instruction/InstructionMethodError.html +110 -0
- data/doc/classes/Instruction/NaNResultError.html +110 -0
- data/doc/classes/Instruction/NotEnoughStackItems.html +110 -0
- data/doc/classes/Instruction.html +500 -0
- data/doc/classes/Instruction.src/M000131.html +17 -0
- data/doc/classes/Instruction.src/M000132.html +15 -0
- data/doc/classes/Instruction.src/M000133.html +15 -0
- data/doc/classes/Instruction.src/M000134.html +15 -0
- data/doc/classes/Instruction.src/M000135.html +15 -0
- data/doc/classes/Instruction.src/M000136.html +15 -0
- data/doc/classes/Instruction.src/M000137.html +15 -0
- data/doc/classes/Instruction.src/M000138.html +15 -0
- data/doc/classes/Instruction.src/M000139.html +22 -0
- data/doc/classes/Instruction.src/M000140.html +15 -0
- data/doc/classes/Instruction.src/M000141.html +25 -0
- data/doc/classes/Instruction.src/M000142.html +15 -0
- data/doc/classes/Instruction.src/M000143.html +15 -0
- data/doc/classes/Instruction.src/M000144.html +15 -0
- data/doc/classes/Instruction.src/M000145.html +15 -0
- data/doc/classes/Instruction.src/M000146.html +15 -0
- data/doc/classes/InstructionNode.html +161 -0
- data/doc/classes/InstructionNode.src/M000247.html +15 -0
- data/doc/classes/InstructionNode.src/M000248.html +16 -0
- data/doc/classes/IntAbsInstruction.html +218 -0
- data/doc/classes/IntAbsInstruction.src/M000175.html +15 -0
- data/doc/classes/IntAbsInstruction.src/M000176.html +15 -0
- data/doc/classes/IntAbsInstruction.src/M000177.html +15 -0
- data/doc/classes/IntAbsInstruction.src/M000178.html +15 -0
- data/doc/classes/IntAddInstruction.html +218 -0
- data/doc/classes/IntAddInstruction.src/M000147.html +15 -0
- data/doc/classes/IntAddInstruction.src/M000148.html +16 -0
- data/doc/classes/IntAddInstruction.src/M000149.html +15 -0
- data/doc/classes/IntAddInstruction.src/M000150.html +15 -0
- data/doc/classes/IntDepthInstruction.html +218 -0
- data/doc/classes/IntDepthInstruction.src/M000211.html +15 -0
- data/doc/classes/IntDepthInstruction.src/M000212.html +14 -0
- data/doc/classes/IntDepthInstruction.src/M000213.html +15 -0
- data/doc/classes/IntDepthInstruction.src/M000214.html +15 -0
- data/doc/classes/IntDivideInstruction.html +218 -0
- data/doc/classes/IntDivideInstruction.src/M000155.html +15 -0
- data/doc/classes/IntDivideInstruction.src/M000156.html +16 -0
- data/doc/classes/IntDivideInstruction.src/M000157.html +20 -0
- data/doc/classes/IntDivideInstruction.src/M000158.html +15 -0
- data/doc/classes/IntDuplicateInstruction.html +218 -0
- data/doc/classes/IntDuplicateInstruction.src/M000203.html +15 -0
- data/doc/classes/IntDuplicateInstruction.src/M000204.html +15 -0
- data/doc/classes/IntDuplicateInstruction.src/M000205.html +15 -0
- data/doc/classes/IntDuplicateInstruction.src/M000206.html +15 -0
- data/doc/classes/IntEqualQInstruction.html +218 -0
- data/doc/classes/IntEqualQInstruction.src/M000023.html +15 -0
- data/doc/classes/IntEqualQInstruction.src/M000024.html +16 -0
- data/doc/classes/IntEqualQInstruction.src/M000025.html +15 -0
- data/doc/classes/IntEqualQInstruction.src/M000026.html +15 -0
- data/doc/classes/IntFlushInstruction.html +218 -0
- data/doc/classes/IntFlushInstruction.src/M000215.html +15 -0
- data/doc/classes/IntFlushInstruction.src/M000216.html +14 -0
- data/doc/classes/IntFlushInstruction.src/M000217.html +14 -0
- data/doc/classes/IntFlushInstruction.src/M000218.html +15 -0
- data/doc/classes/IntFromBoolInstruction.html +218 -0
- data/doc/classes/IntFromBoolInstruction.src/M000051.html +15 -0
- data/doc/classes/IntFromBoolInstruction.src/M000052.html +15 -0
- data/doc/classes/IntFromBoolInstruction.src/M000053.html +15 -0
- data/doc/classes/IntFromBoolInstruction.src/M000054.html +15 -0
- data/doc/classes/IntFromFloatInstruction.html +218 -0
- data/doc/classes/IntFromFloatInstruction.src/M000059.html +15 -0
- data/doc/classes/IntFromFloatInstruction.src/M000060.html +15 -0
- data/doc/classes/IntFromFloatInstruction.src/M000061.html +15 -0
- data/doc/classes/IntFromFloatInstruction.src/M000062.html +15 -0
- data/doc/classes/IntGreaterThanQInstruction.html +218 -0
- data/doc/classes/IntGreaterThanQInstruction.src/M000031.html +15 -0
- data/doc/classes/IntGreaterThanQInstruction.src/M000032.html +16 -0
- data/doc/classes/IntGreaterThanQInstruction.src/M000033.html +15 -0
- data/doc/classes/IntGreaterThanQInstruction.src/M000034.html +15 -0
- data/doc/classes/IntIfInstruction.html +218 -0
- data/doc/classes/IntIfInstruction.src/M000043.html +16 -0
- data/doc/classes/IntIfInstruction.src/M000044.html +15 -0
- data/doc/classes/IntIfInstruction.src/M000045.html +14 -0
- data/doc/classes/IntIfInstruction.src/M000046.html +17 -0
- data/doc/classes/IntLessThanQInstruction.html +218 -0
- data/doc/classes/IntLessThanQInstruction.src/M000027.html +15 -0
- data/doc/classes/IntLessThanQInstruction.src/M000028.html +16 -0
- data/doc/classes/IntLessThanQInstruction.src/M000029.html +15 -0
- data/doc/classes/IntLessThanQInstruction.src/M000030.html +15 -0
- data/doc/classes/IntMaxInstruction.html +218 -0
- data/doc/classes/IntMaxInstruction.src/M000167.html +15 -0
- data/doc/classes/IntMaxInstruction.src/M000168.html +16 -0
- data/doc/classes/IntMaxInstruction.src/M000169.html +16 -0
- data/doc/classes/IntMaxInstruction.src/M000170.html +15 -0
- data/doc/classes/IntMinInstruction.html +218 -0
- data/doc/classes/IntMinInstruction.src/M000171.html +15 -0
- data/doc/classes/IntMinInstruction.src/M000172.html +16 -0
- data/doc/classes/IntMinInstruction.src/M000173.html +16 -0
- data/doc/classes/IntMinInstruction.src/M000174.html +15 -0
- data/doc/classes/IntModuloInstruction.html +218 -0
- data/doc/classes/IntModuloInstruction.src/M000163.html +15 -0
- data/doc/classes/IntModuloInstruction.src/M000164.html +16 -0
- data/doc/classes/IntModuloInstruction.src/M000165.html +20 -0
- data/doc/classes/IntModuloInstruction.src/M000166.html +15 -0
- data/doc/classes/IntMultiplyInstruction.html +218 -0
- data/doc/classes/IntMultiplyInstruction.src/M000151.html +15 -0
- data/doc/classes/IntMultiplyInstruction.src/M000152.html +16 -0
- data/doc/classes/IntMultiplyInstruction.src/M000153.html +15 -0
- data/doc/classes/IntMultiplyInstruction.src/M000154.html +15 -0
- data/doc/classes/IntNegativeInstruction.html +218 -0
- data/doc/classes/IntNegativeInstruction.src/M000179.html +15 -0
- data/doc/classes/IntNegativeInstruction.src/M000180.html +15 -0
- data/doc/classes/IntNegativeInstruction.src/M000181.html +15 -0
- data/doc/classes/IntNegativeInstruction.src/M000182.html +15 -0
- data/doc/classes/IntPopInstruction.html +218 -0
- data/doc/classes/IntPopInstruction.src/M000195.html +15 -0
- data/doc/classes/IntPopInstruction.src/M000196.html +15 -0
- data/doc/classes/IntPopInstruction.src/M000197.html +14 -0
- data/doc/classes/IntPopInstruction.src/M000198.html +14 -0
- data/doc/classes/IntRandomInstruction.html +218 -0
- data/doc/classes/IntRandomInstruction.src/M000183.html +15 -0
- data/doc/classes/IntRandomInstruction.src/M000184.html +14 -0
- data/doc/classes/IntRandomInstruction.src/M000185.html +15 -0
- data/doc/classes/IntRandomInstruction.src/M000186.html +15 -0
- data/doc/classes/IntRotateInstruction.html +218 -0
- data/doc/classes/IntRotateInstruction.src/M000207.html +15 -0
- data/doc/classes/IntRotateInstruction.src/M000208.html +17 -0
- data/doc/classes/IntRotateInstruction.src/M000209.html +14 -0
- data/doc/classes/IntRotateInstruction.src/M000210.html +17 -0
- data/doc/classes/IntSubtractInstruction.html +218 -0
- data/doc/classes/IntSubtractInstruction.src/M000159.html +15 -0
- data/doc/classes/IntSubtractInstruction.src/M000160.html +16 -0
- data/doc/classes/IntSubtractInstruction.src/M000161.html +16 -0
- data/doc/classes/IntSubtractInstruction.src/M000162.html +15 -0
- data/doc/classes/IntSwapInstruction.html +218 -0
- data/doc/classes/IntSwapInstruction.src/M000199.html +15 -0
- data/doc/classes/IntSwapInstruction.src/M000200.html +16 -0
- data/doc/classes/IntSwapInstruction.src/M000201.html +14 -0
- data/doc/classes/IntSwapInstruction.src/M000202.html +16 -0
- data/doc/classes/IntType.html +240 -0
- data/doc/classes/IntType.src/M000235.html +15 -0
- data/doc/classes/IntType.src/M000236.html +15 -0
- data/doc/classes/IntType.src/M000237.html +18 -0
- data/doc/classes/IntType.src/M000238.html +15 -0
- data/doc/classes/IntType.src/M000239.html +15 -0
- data/doc/classes/LiteralNode.html +183 -0
- data/doc/classes/LiteralNode.src/M000251.html +15 -0
- data/doc/classes/LiteralNode.src/M000252.html +16 -0
- data/doc/classes/LiteralNode.src/M000253.html +16 -0
- data/doc/classes/Nudge/Channel.html +437 -0
- data/doc/classes/Nudge/Channel.src/M000286.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000287.html +19 -0
- data/doc/classes/Nudge/Channel.src/M000288.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000289.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000290.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000291.html +19 -0
- data/doc/classes/Nudge/Channel.src/M000292.html +19 -0
- data/doc/classes/Nudge/Channel.src/M000293.html +17 -0
- data/doc/classes/Nudge/Channel.src/M000294.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000295.html +20 -0
- data/doc/classes/Nudge/Channel.src/M000296.html +15 -0
- data/doc/classes/Nudge/Channel.src/M000297.html +17 -0
- data/doc/classes/Nudge/Channel.src/M000298.html +15 -0
- data/doc/classes/Nudge/CodeBlock.html +331 -0
- data/doc/classes/Nudge/CodeBlock.src/M000263.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000264.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000265.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000266.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000267.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000268.html +17 -0
- data/doc/classes/Nudge/CodeBlock.src/M000269.html +20 -0
- data/doc/classes/Nudge/CodeBlock.src/M000270.html +15 -0
- data/doc/classes/Nudge/CodeBlock.src/M000271.html +19 -0
- data/doc/classes/Nudge/DeadLocation.html +152 -0
- data/doc/classes/Nudge/DeadLocation.src/M000334.html +17 -0
- data/doc/classes/Nudge/Erc.html +335 -0
- data/doc/classes/Nudge/Erc.src/M000278.html +16 -0
- data/doc/classes/Nudge/Erc.src/M000279.html +15 -0
- data/doc/classes/Nudge/Erc.src/M000280.html +15 -0
- data/doc/classes/Nudge/Erc.src/M000281.html +15 -0
- data/doc/classes/Nudge/Erc.src/M000282.html +18 -0
- data/doc/classes/Nudge/Erc.src/M000283.html +15 -0
- data/doc/classes/Nudge/Erc.src/M000284.html +17 -0
- data/doc/classes/Nudge/Erc.src/M000285.html +15 -0
- data/doc/classes/Nudge/Individual.html +313 -0
- data/doc/classes/Nudge/Individual.src/M000314.html +21 -0
- data/doc/classes/Nudge/Individual.src/M000315.html +15 -0
- data/doc/classes/Nudge/Individual.src/M000316.html +15 -0
- data/doc/classes/Nudge/Individual.src/M000317.html +17 -0
- data/doc/classes/Nudge/Individual.src/M000318.html +25 -0
- data/doc/classes/Nudge/InstructionPoint/InstructionNotFoundError.html +110 -0
- data/doc/classes/Nudge/InstructionPoint.html +350 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000299.html +15 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000300.html +15 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000301.html +17 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000302.html +15 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000303.html +17 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000304.html +17 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000305.html +17 -0
- data/doc/classes/Nudge/InstructionPoint.src/M000306.html +15 -0
- data/doc/classes/Nudge/Interpreter.html +369 -0
- data/doc/classes/Nudge/Interpreter.src/M000257.html +20 -0
- data/doc/classes/Nudge/Interpreter.src/M000258.html +19 -0
- data/doc/classes/Nudge/Interpreter.src/M000259.html +15 -0
- data/doc/classes/Nudge/Interpreter.src/M000260.html +19 -0
- data/doc/classes/Nudge/Interpreter.src/M000261.html +17 -0
- data/doc/classes/Nudge/LiteralPoint.html +291 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000272.html +16 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000273.html +15 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000274.html +15 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000275.html +18 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000276.html +17 -0
- data/doc/classes/Nudge/LiteralPoint.src/M000277.html +15 -0
- data/doc/classes/Nudge/Location.html +525 -0
- data/doc/classes/Nudge/Location.src/M000319.html +19 -0
- data/doc/classes/Nudge/Location.src/M000320.html +15 -0
- data/doc/classes/Nudge/Location.src/M000321.html +26 -0
- data/doc/classes/Nudge/Location.src/M000322.html +15 -0
- data/doc/classes/Nudge/Location.src/M000323.html +20 -0
- data/doc/classes/Nudge/Location.src/M000324.html +16 -0
- data/doc/classes/Nudge/Location.src/M000325.html +25 -0
- data/doc/classes/Nudge/Location.src/M000326.html +15 -0
- data/doc/classes/Nudge/Location.src/M000327.html +21 -0
- data/doc/classes/Nudge/Location.src/M000328.html +16 -0
- data/doc/classes/Nudge/Location.src/M000329.html +15 -0
- data/doc/classes/Nudge/Location.src/M000330.html +16 -0
- data/doc/classes/Nudge/Location.src/M000331.html +20 -0
- data/doc/classes/Nudge/Location.src/M000332.html +17 -0
- data/doc/classes/Nudge/Location.src/M000333.html +17 -0
- data/doc/classes/Nudge/NondominatedSubset.html +196 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000005.html +19 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000006.html +19 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000007.html +25 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000339.html +19 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000340.html +19 -0
- data/doc/classes/Nudge/NondominatedSubset.src/M000341.html +25 -0
- data/doc/classes/Nudge/PopulationResample.html +175 -0
- data/doc/classes/Nudge/PopulationResample.src/M000003.html +22 -0
- data/doc/classes/Nudge/PopulationResample.src/M000337.html +22 -0
- data/doc/classes/Nudge/ProgramPoint.html +148 -0
- data/doc/classes/Nudge/ProgramPoint.src/M000262.html +15 -0
- data/doc/classes/Nudge/RandomGuess.html +176 -0
- data/doc/classes/Nudge/RandomGuess.src/M000002.html +21 -0
- data/doc/classes/Nudge/RandomGuess.src/M000336.html +21 -0
- data/doc/classes/Nudge/ResampleValues.html +169 -0
- data/doc/classes/Nudge/ResampleValues.src/M000004.html +36 -0
- data/doc/classes/Nudge/ResampleValues.src/M000338.html +36 -0
- data/doc/classes/Nudge/SearchOperator.html +175 -0
- data/doc/classes/Nudge/SearchOperator.src/M000001.html +15 -0
- data/doc/classes/Nudge/SearchOperator.src/M000335.html +15 -0
- data/doc/classes/Nudge/Stack.html +350 -0
- data/doc/classes/Nudge/Stack.src/M000307.html +15 -0
- data/doc/classes/Nudge/Stack.src/M000308.html +15 -0
- data/doc/classes/Nudge/Stack.src/M000309.html +18 -0
- data/doc/classes/Nudge/Stack.src/M000310.html +15 -0
- data/doc/classes/Nudge/Stack.src/M000311.html +15 -0
- data/doc/classes/Nudge/Stack.src/M000312.html +15 -0
- data/doc/classes/Nudge/Stack.src/M000313.html +15 -0
- data/doc/classes/Nudge/UniformBackboneCrossover.html +152 -0
- data/doc/classes/Nudge/UniformBackboneCrossover.src/M000008.html +35 -0
- data/doc/classes/Nudge/UniformBackboneCrossover.src/M000342.html +35 -0
- data/doc/classes/Nudge.html +174 -0
- data/doc/classes/NudgeType.html +363 -0
- data/doc/classes/NudgeType.src/M000225.html +17 -0
- data/doc/classes/NudgeType.src/M000226.html +15 -0
- data/doc/classes/NudgeType.src/M000227.html +15 -0
- data/doc/classes/NudgeType.src/M000228.html +15 -0
- data/doc/classes/NudgeType.src/M000229.html +15 -0
- data/doc/classes/NudgeType.src/M000230.html +15 -0
- data/doc/classes/NudgeType.src/M000231.html +15 -0
- data/doc/classes/NudgeType.src/M000232.html +15 -0
- data/doc/classes/NudgeType.src/M000233.html +15 -0
- data/doc/classes/NudgeType.src/M000234.html +15 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/instructions/bool_basics_rb.html +90 -0
- data/doc/files/lib/instructions/comparisons_rb.html +90 -0
- data/doc/files/lib/instructions/conditionals_rb.html +90 -0
- data/doc/files/lib/instructions/conversions_rb.html +90 -0
- data/doc/files/lib/instructions/exec_rb.html +90 -0
- data/doc/files/lib/instructions/float_arithmetic_rb.html +90 -0
- data/doc/files/lib/instructions/float_transcendental_rb.html +90 -0
- data/doc/files/lib/instructions/infrastructure_rb.html +100 -0
- data/doc/files/lib/instructions/int_arithmetic_rb.html +90 -0
- data/doc/files/lib/instructions/random_value_rb.html +90 -0
- data/doc/files/lib/instructions/stack_manipulation_rb.html +90 -0
- data/doc/files/lib/interpreter/grammars/nudge_language_helpers_rb.html +97 -0
- data/doc/files/lib/interpreter/grammars/nudge_language_treetop.html +180 -0
- data/doc/files/lib/interpreter/interpreter_rb.html +90 -0
- data/doc/files/lib/interpreter/programPoints_rb.html +90 -0
- data/doc/files/lib/interpreter/stack_rb.html +90 -0
- data/doc/files/lib/interpreter/types/codeType_rb.html +157 -0
- data/doc/files/lib/interpreter/types/codeType_rb.src/M000001.html +15 -0
- data/doc/files/lib/interpreter/types/codeType_rb.src/M000002.html +15 -0
- data/doc/files/lib/interpreter/types/pushTypes_rb.html +107 -0
- data/doc/files/lib/nudge_rb.html +152 -0
- data/doc/files/lib/search/evaluators/structural_complexity_rb.html +90 -0
- data/doc/files/lib/search/helpers_rb.html +90 -0
- data/doc/files/lib/search/individual/individual_rb.html +90 -0
- data/doc/files/lib/search/locations/location_rb.html +100 -0
- data/doc/files/lib/search/operators/basic_operators_rb.html +90 -0
- data/doc/fr_class_index.html +191 -0
- data/doc/fr_file_index.html +71 -0
- data/doc/fr_method_index.html +711 -0
- data/doc/index.html +21 -0
- data/doc/rdoc-style.css +299 -0
- data/features/parser_recognizes_nudge_language.feature +9 -0
- data/lib/instructions/bool_basics.rb +85 -0
- data/lib/instructions/code_basics.rb +14 -0
- data/lib/instructions/comparisons.rb +152 -0
- data/lib/instructions/conditionals.rb +44 -0
- data/lib/instructions/conversions.rb +94 -0
- data/lib/instructions/exec.rb +154 -0
- data/lib/instructions/float_arithmetic.rb +201 -0
- data/lib/instructions/float_transcendental.rb +47 -0
- data/lib/instructions/infrastructure.rb +84 -0
- data/lib/instructions/int_arithmetic.rb +160 -0
- data/lib/instructions/name_basics.rb +44 -0
- data/lib/instructions/name_bindings.rb +65 -0
- data/lib/instructions/random_value.rb +43 -0
- data/lib/instructions/stack_manipulation.rb +739 -0
- data/lib/interpreter/grammars/nudge_language.treetop +83 -0
- data/lib/interpreter/grammars/nudge_language_helpers.rb +64 -0
- data/lib/interpreter/interpreter.rb +176 -0
- data/lib/interpreter/programPoints.rb +236 -0
- data/lib/interpreter/stack.rb +39 -0
- data/lib/interpreter/types/codeType.rb +108 -0
- data/lib/interpreter/types/pushTypes.rb +102 -0
- data/lib/nudge.rb +38 -0
- data/lib/search/experiments/experiment.rb +53 -0
- data/lib/search/helpers.rb +22 -0
- data/lib/search/individual/batch.rb +25 -0
- data/lib/search/individual/individual.rb +147 -0
- data/lib/search/operators/basic_operators.rb +230 -0
- data/lib/search/operators/evaluators.rb +107 -0
- data/lib/search/operators/samplers_and_selectors.rb +123 -0
- data/lib/search/stations/station.rb +147 -0
- data/push_language_coverage.md +177 -0
- data/readme.md +19 -0
- data/spec/data/couchdb_spec.rb +2 -0
- data/spec/fixtures/just_block.example +1 -0
- data/spec/fixtures/just_block_with_newline.example +1 -0
- data/spec/fixtures/long_arithmetic.example +7 -0
- data/spec/fixtures/one_line_instr.example +1 -0
- data/spec/fixtures/untidy1.example +20 -0
- data/spec/fixtures/untidy1fixed.example +12 -0
- data/spec/instructions/bool_basics_spec.rb +97 -0
- data/spec/instructions/bool_stack_spec.rb +391 -0
- data/spec/instructions/code_basics_spec.rb +43 -0
- data/spec/instructions/code_stack_spec.rb +382 -0
- data/spec/instructions/comparisons_spec.rb +486 -0
- data/spec/instructions/conditionals_spec.rb +162 -0
- data/spec/instructions/conversions_spec.rb +92 -0
- data/spec/instructions/exec_spec.rb +883 -0
- data/spec/instructions/float_calculations_spec.rb +148 -0
- data/spec/instructions/float_stack_spec.rb +382 -0
- data/spec/instructions/float_transcendental_spec.rb +89 -0
- data/spec/instructions/instruction_class_spec.rb +9 -0
- data/spec/instructions/int_calculations_spec.rb +125 -0
- data/spec/instructions/int_stack_spec.rb +398 -0
- data/spec/instructions/name_basics_spec.rb +158 -0
- data/spec/instructions/name_bindings_spec.rb +257 -0
- data/spec/instructions/name_stack_spec.rb +382 -0
- data/spec/instructions/random_values_spec.rb +68 -0
- data/spec/integration/search_integration.rb +67 -0
- data/spec/interpreter/channel_spec.rb +92 -0
- data/spec/interpreter/codeblock_spec.rb +135 -0
- data/spec/interpreter/codetype_spec.rb +257 -0
- data/spec/interpreter/erc_spec.rb +130 -0
- data/spec/interpreter/instruction_spec.rb +97 -0
- data/spec/interpreter/interpreter_spec.rb +266 -0
- data/spec/interpreter/literal_spec.rb +94 -0
- data/spec/interpreter/parser_spec.rb +324 -0
- data/spec/interpreter/stack_spec.rb +81 -0
- data/spec/interpreter/types_spec.rb +102 -0
- data/spec/search/batch_spec.rb +30 -0
- data/spec/search/experiments/experiment_spec.rb +101 -0
- data/spec/search/helpers_spec.rb +59 -0
- data/spec/search/individual_spec.rb +356 -0
- data/spec/search/operators/any_one_sampler_spec.rb +40 -0
- data/spec/search/operators/dominated_quantile_spec.rb +111 -0
- data/spec/search/operators/duplicate_genomes_spec.rb +35 -0
- data/spec/search/operators/evaluators/program_point_evaluator_spec.rb +43 -0
- data/spec/search/operators/evaluators/test_case_evaluator_spec.rb +133 -0
- data/spec/search/operators/infrastructure_spec.rb +47 -0
- data/spec/search/operators/most_dominated_subset_spec.rb +47 -0
- data/spec/search/operators/nondominated_subset_spec.rb +97 -0
- data/spec/search/operators/pointCrossover_spec.rb +55 -0
- data/spec/search/operators/pointDeletion_spec.rb +57 -0
- data/spec/search/operators/pointMutation_spec.rb +71 -0
- data/spec/search/operators/random_guess_spec.rb +51 -0
- data/spec/search/operators/resample_and_clone_spec.rb +50 -0
- data/spec/search/operators/resample_values_spec.rb +126 -0
- data/spec/search/operators/sizePreservingMutation_spec.rb +2 -0
- data/spec/search/operators/uniformBackboneCrossover_spec.rb +63 -0
- data/spec/search/stations/station_spec.rb +496 -0
- data/spec/spec_helper.rb +11 -0
- metadata +738 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe "Couch Writing" do
|
5
|
+
before(:each) do
|
6
|
+
Station.cleanup
|
7
|
+
time_now = Time.now
|
8
|
+
Time.stub!(:now).and_return(time_now)
|
9
|
+
time_now.stub!(:to_i).and_return(999999)
|
10
|
+
|
11
|
+
@dude = Individual.new("block {}")
|
12
|
+
@homeBase = Station.new("away")
|
13
|
+
@dude.scores = {"happiness" => 54}
|
14
|
+
@homeBase.add_individual(@dude)
|
15
|
+
|
16
|
+
@theActualDB = CouchRest.database!(@homeBase.database)
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:each) do
|
20
|
+
@theActualDB.delete!
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
it "should write its data to the database for its Station" do
|
25
|
+
@dude.write
|
26
|
+
@dude.id.should_not == nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should write the genome" do
|
30
|
+
@dude.write
|
31
|
+
id = @dude.id
|
32
|
+
foundThing = @theActualDB.get(id)
|
33
|
+
foundThing["genome"].should == @dude.genome
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should write the scores hash" do
|
37
|
+
@dude.write
|
38
|
+
id = @dude.id
|
39
|
+
foundThing = @theActualDB.get(id)
|
40
|
+
foundThing["scores"].should == @dude.scores
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should write the birthmoment of the individual" do
|
44
|
+
@dude.write
|
45
|
+
id = @dude.id
|
46
|
+
foundThing = @theActualDB.get(id)
|
47
|
+
foundThing["creation_time"].should == 999999
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "Individual#find in Couch" do
|
52
|
+
before(:each) do
|
53
|
+
@couch_url = "http://localhost:5984/slash"
|
54
|
+
@theActualDB = CouchRest.database!(@couch_url)
|
55
|
+
@theData = {"genome"=>"do int_add", "scores"=> {"happiness"=>99}, "creation_time"=> 10000}
|
56
|
+
theResult = @theActualDB.save_doc(@theData)
|
57
|
+
@oldID = theResult["id"]
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return an Individual from a couch_url with a given ID" do
|
61
|
+
dude = Individual.get(@couch_url,@oldID)
|
62
|
+
dude.id.should == @oldID
|
63
|
+
dude.genome.should == @theData["genome"]
|
64
|
+
dude.scores.should == @theData["scores"]
|
65
|
+
dude.timestamp.should == @theData["creation_time"]
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
|
5
|
+
describe "Channel Point" do
|
6
|
+
it "should be a kind of program point" do
|
7
|
+
myC = ChannelPoint.new("x")
|
8
|
+
myC.should be_a_kind_of(ProgramPoint)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have a name parameter with no default" do
|
12
|
+
myC = ChannelPoint.new("x")
|
13
|
+
myC.should be_a_kind_of(ChannelPoint)
|
14
|
+
myC.name.should == "x"
|
15
|
+
lambda {ChannelPoint.new()}.should raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#go" do
|
19
|
+
before(:each) do
|
20
|
+
@ii = Interpreter.new()
|
21
|
+
@ii.reset("block{\nref x\nref y\nref z}")
|
22
|
+
@ii.bind_variable("x", LiteralPoint.new("float", 1.1))
|
23
|
+
@ii.bind_name("y", LiteralPoint.new("int", 99999))
|
24
|
+
#reference "z" is unbound
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should pop the exec stack when the program_point ChannelPoint is interpreted" do
|
28
|
+
@ii.stacks[:exec].depth.should == 1
|
29
|
+
@ii.step
|
30
|
+
@ii.stacks[:exec].depth.should == 3
|
31
|
+
@ii.step
|
32
|
+
@ii.stacks[:exec].depth.should == 3
|
33
|
+
@ii.stacks[:exec].peek.value.should == 1.1
|
34
|
+
2.times {@ii.step}
|
35
|
+
@ii.stacks[:exec].depth.should == 2
|
36
|
+
@ii.stacks[:exec].peek.value.should == 99999
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should push the ChannelPoint object onto the :name stack if it's not bound" do
|
40
|
+
6.times {@ii.step}
|
41
|
+
@ii.stacks[:name].depth.should == 1
|
42
|
+
@ii.stacks[:name].peek.name.should == "z"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should push the value onto the right stack" do
|
46
|
+
3.times {@ii.step}
|
47
|
+
@ii.stacks[:float].peek.value.should == 1.1
|
48
|
+
2.times {@ii.step}
|
49
|
+
@ii.stacks[:int].peek.value.should == 99999
|
50
|
+
@ii.step
|
51
|
+
@ii.stacks[:name].peek.name.should == "z"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#tidy" do
|
56
|
+
it "should return 'ref x' when the name is 'x'" do
|
57
|
+
myC = ChannelPoint.new("x")
|
58
|
+
myC.tidy.should == "ref x"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "randomize" do
|
63
|
+
it "should set the ChannelPoint's name to a randomly selected channel or name key" do
|
64
|
+
context = Interpreter.new
|
65
|
+
context.reset_variables
|
66
|
+
context.reset_names
|
67
|
+
myC = ChannelPoint.new("a")
|
68
|
+
context.bind_name("y",LiteralPoint.new("bool", false))
|
69
|
+
myC.randomize(context)
|
70
|
+
myC.name.should == "y"
|
71
|
+
context.reset_names
|
72
|
+
context.bind_variable("z",LiteralPoint.new("bool", false))
|
73
|
+
myC.randomize(context)
|
74
|
+
myC.name.should == "z"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#any" do
|
79
|
+
it "should be a class method that returns a completely random instance of a ChannelPoint" do
|
80
|
+
context = Interpreter.new
|
81
|
+
context.reset_variables
|
82
|
+
context.reset_names
|
83
|
+
context.bind_name("y",LiteralPoint.new("bool", false))
|
84
|
+
rC = ChannelPoint.any(context)
|
85
|
+
rC.name.should == "y"
|
86
|
+
context.reset_names
|
87
|
+
context.bind_variable("d",LiteralPoint.new("bool", false))
|
88
|
+
rC = ChannelPoint.any(context)
|
89
|
+
rC.name.should == "d"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
3
|
+
include Nudge
|
4
|
+
|
5
|
+
describe "codeblock objects" do
|
6
|
+
describe "should only accept #new from a NudgeLanguageParser"
|
7
|
+
|
8
|
+
it "should be a kind of program point" do
|
9
|
+
myB = CodeBlock.new()
|
10
|
+
myB.should be_a_kind_of(ProgramPoint)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should take a listing as a param, default to 'block {}'" do
|
14
|
+
sCode = CodeBlock.new()
|
15
|
+
sCode.listing.should == "block {}"
|
16
|
+
tCode = CodeBlock.new("block {\n literal int, 3}")
|
17
|
+
tCode.listing.should == "block {\n literal int, 3}"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should expose its #contents" do
|
21
|
+
parser = NudgeLanguageParser.new()
|
22
|
+
cbs = ["block {\n literal int(3)}",
|
23
|
+
"block { do int_add \ndo int_subtract\n do int_divide}",
|
24
|
+
"block { block{}}", "block{ block{ do int_add block{ block{} block{}}} }"]
|
25
|
+
|
26
|
+
cbs.each do |myCode|
|
27
|
+
handMade = CodeBlock.new(myCode)
|
28
|
+
generated = parser.parse(myCode).to_points
|
29
|
+
handMade.contents.length.should == generated.contents.length
|
30
|
+
handMade.contents[0].tidy.should == generated.contents[0].tidy
|
31
|
+
handMade.listing.should == generated.listing
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
it "should return an indented nested text version for #tidy" do
|
37
|
+
parser = NudgeLanguageParser.new()
|
38
|
+
myB = parser.parse("block {}").to_points
|
39
|
+
myB.tidy.should == "block {}"
|
40
|
+
|
41
|
+
myB = parser.parse("block {\n\n}").to_points
|
42
|
+
myB.tidy.should == "block {}"
|
43
|
+
|
44
|
+
myB = parser.parse("block {\nblock{}\n}").to_points
|
45
|
+
myB.tidy.should == "block {\n block {}}"
|
46
|
+
|
47
|
+
myB = parser.parse("block {\nblock{\nblock{}}\n}").to_points
|
48
|
+
myB.tidy.should == "block {\n block {\n block {}}}"
|
49
|
+
|
50
|
+
myB = parser.parse("block {\nblock{}\nblock{}}").to_points
|
51
|
+
myB.tidy.should == "block {\n block {}\n block {}}"
|
52
|
+
|
53
|
+
myB = parser.parse("block {\ndo x\ndo y}").to_points
|
54
|
+
myB.tidy.should == "block {\n do x\n do y}"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "--no really, even for VERY complicated trees" do
|
58
|
+
parser = NudgeLanguageParser.new()
|
59
|
+
myComplicated = fixture(:untidy1)
|
60
|
+
myExpected = fixture(:untidy1fixed)
|
61
|
+
myB = parser.parse(myComplicated).to_points
|
62
|
+
myB.tidy.should == myExpected.chomp
|
63
|
+
|
64
|
+
myDeep = "block {"* 88 + "}"*88
|
65
|
+
myB = parser.parse(myDeep).to_points
|
66
|
+
myB.tidy.split(/\n/).length.should == 88
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#go" do
|
71
|
+
describe "should split at the root #contents level and push IN REVERSE ORDER back onto :exec" do
|
72
|
+
before(:each) do
|
73
|
+
@ii = Interpreter.new()
|
74
|
+
@ii.clear_stacks
|
75
|
+
end
|
76
|
+
|
77
|
+
it " : if it is an empty Codeblock" do
|
78
|
+
@ii.reset("block {}")
|
79
|
+
@ii.step
|
80
|
+
@ii.stacks[:exec].depth.should == 0
|
81
|
+
end
|
82
|
+
|
83
|
+
it " : if it is a long, flat Codeblock" do
|
84
|
+
@ii.reset("block {\nliteral int(1)\nliteral int(2)\nliteral int(3)\nliteral int(4)}")
|
85
|
+
@ii.stacks[:exec].depth.should == 1
|
86
|
+
@ii.step
|
87
|
+
@ii.stacks[:exec].depth.should == 4
|
88
|
+
@ii.stacks[:exec].pop.value.should == 1
|
89
|
+
@ii.stacks[:exec].pop.value.should == 2
|
90
|
+
@ii.stacks[:exec].pop.value.should == 3
|
91
|
+
@ii.stacks[:exec].pop.value.should == 4
|
92
|
+
@ii.stacks[:exec].pop.should == nil
|
93
|
+
end
|
94
|
+
|
95
|
+
it " : if it is a deeply nested Codeblock" do
|
96
|
+
@ii.reset("block {\nblock {\n block {\nliteral int (1)}\nliteral bool (false)}}")
|
97
|
+
@ii.stacks[:exec].depth.should == 1
|
98
|
+
@ii.step
|
99
|
+
@ii.stacks[:exec].depth.should == 1
|
100
|
+
@ii.step
|
101
|
+
@ii.stacks[:exec].depth.should == 2
|
102
|
+
@ii.step
|
103
|
+
@ii.stacks[:exec].depth.should == 2
|
104
|
+
item = @ii.stacks[:exec].pop
|
105
|
+
item.should be_a_kind_of(LiteralPoint)
|
106
|
+
item.value.should == 1
|
107
|
+
item = @ii.stacks[:exec].pop
|
108
|
+
item.should be_a_kind_of(LiteralPoint)
|
109
|
+
item.value.should == false
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
describe "codeblock methods" do
|
116
|
+
describe "#points" do
|
117
|
+
it "should return the number of lines in the block" do
|
118
|
+
myP = CodeBlock.new("block {}")
|
119
|
+
myP.points.should == 1
|
120
|
+
|
121
|
+
myP = CodeBlock.new("block { block { block {}}}")
|
122
|
+
myP.points.should == 3
|
123
|
+
|
124
|
+
myP = CodeBlock.new("block { block {} block {}}")
|
125
|
+
myP.points.should == 3
|
126
|
+
|
127
|
+
myP = CodeBlock.new("block { do int_add}")
|
128
|
+
myP.points.should == 2
|
129
|
+
|
130
|
+
myP = CodeBlock.new("block { do int_add ref x1\nref x2}")
|
131
|
+
myP.points.should == 4
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe "Code Type" do
|
5
|
+
it "should be a Singleton" do
|
6
|
+
CodeType.instance.should be_a_kind_of(Singleton)
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
it "should return the result of self.randomize when it receives an #any_value call" do
|
11
|
+
CodeType.should_receive(:random_value).and_return("hi there!")
|
12
|
+
CodeType.any_value(Interpreter.new).should == "hi there!"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
describe "#random_skeleton" do
|
18
|
+
it "should accept params for points and branchiness" do
|
19
|
+
lambda{CodeType.random_skeleton(3,1)}.should_not raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return a string filled with asterisks and 'block{}'" do
|
23
|
+
CodeType.random_skeleton(3,0).should == "block {**}"
|
24
|
+
CodeType.random_skeleton(3,1).should == "block {**}"
|
25
|
+
CodeType.random_skeleton(1,1).should == "block {}"
|
26
|
+
CodeType.random_skeleton(2,2).should == "block { block {}}"
|
27
|
+
CodeType.random_skeleton(20,3).count("}").should == 3
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should limit range-check the blocks parameter" do
|
31
|
+
CodeType.random_skeleton(1,40).should == "block {}"
|
32
|
+
CodeType.random_skeleton(4,20).count("}").should == 4
|
33
|
+
CodeType.random_skeleton(4,-20).count("}").should == 1
|
34
|
+
CodeType.random_skeleton(1,-20).should == "*"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
describe "any_type" do
|
41
|
+
before(:each) do
|
42
|
+
@context = Interpreter.new
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return a single sample from the #types method of the context passed in" do
|
46
|
+
@context = Interpreter.new
|
47
|
+
@context.disable_all_types
|
48
|
+
@context.enable(IntType)
|
49
|
+
CodeType.any_type(@context.types).should == IntType
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should default to the list of active types in the context" do
|
53
|
+
@context.disable_all_types
|
54
|
+
@context.enable(IntType)
|
55
|
+
CodeType.any_type(@context.types).should == IntType
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should raise an error if the list of active_types is empty and none is passed in" do
|
59
|
+
@context.disable_all_types
|
60
|
+
lambda{CodeType.any_type(@context.types)}.should raise_error(ArgumentError)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should raise an error if the list of types passed in is empty" do
|
64
|
+
@context.disable_all_types
|
65
|
+
lambda{CodeType.any_type(@context.types)}.should raise_error(ArgumentError)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
describe "any_instruction" do
|
72
|
+
before(:each) do
|
73
|
+
@context = Interpreter.new
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return a single sample from the context passed in (no implied validation)" do
|
77
|
+
@context.disable_all_instructions
|
78
|
+
@context.enable(IntAddInstruction)
|
79
|
+
CodeType.any_instruction(@context.instructions).should == IntAddInstruction
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should raise an error if the no instructions are active in the context and none are passed in" do
|
83
|
+
@context.disable_all_instructions
|
84
|
+
lambda{CodeType.any_instruction(@context.instructions)}.should raise_error(ArgumentError)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "any_reference" do
|
89
|
+
before(:each) do
|
90
|
+
@context = Interpreter.new
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should return a random reference from the context" do
|
94
|
+
@context.reset_variables
|
95
|
+
@context.bind_variable("x",LiteralPoint.new(:int,12))
|
96
|
+
CodeType.any_reference(@context.references).should == "x"
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
it "should raise an error if the list of active references is empty" do
|
101
|
+
@context.reset_variables
|
102
|
+
@context.reset_names
|
103
|
+
lambda{CodeType.any_reference(@context.references)}.should raise_error(ArgumentError)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
describe "#random_value" do
|
110
|
+
before(:each) do
|
111
|
+
@context = Interpreter.new
|
112
|
+
@context.reset_variables
|
113
|
+
@context.reset_names
|
114
|
+
@context.disable_all_instructions
|
115
|
+
@context.disable_all_types
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "skeletons" do
|
119
|
+
before(:each) do
|
120
|
+
@context.enable(IntType)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should use a points parameter to set the length" do
|
124
|
+
rp = CodeType.random_value(@context,:points => 3)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should by default generate a random skeleton" do
|
128
|
+
CodeType.should_receive(:random_skeleton).and_return("**")
|
129
|
+
rp = CodeType.random_value(@context,:points => 2)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should allow a skeleton to be passed in as a param" do
|
133
|
+
CodeType.should_not_receive(:random_skeleton)
|
134
|
+
rp = CodeType.random_value(@context,:skeleton => "**")
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should allow a partially filled-in skeleton to be passed in" do
|
138
|
+
rp = CodeType.random_value(@context,:skeleton => "* do thing")
|
139
|
+
rp.should include(" do thing")
|
140
|
+
rp.should_not include("*")
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should always return a one-line program listing (no linefeeds)" do
|
144
|
+
rp = CodeType.random_value(@context, :points => 10, :blocks => 5)
|
145
|
+
rp.should_not include("\n")
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should use '@' as a placeholder that is not replaced with code" do
|
149
|
+
rp = CodeType.random_value(@context, :skeleton => "@ do thing")
|
150
|
+
rp.should == "@ do thing"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe "argument checking" do
|
155
|
+
it "should raise an ArgumentError if there are no Instructions, References or Types" do
|
156
|
+
@context.reset_variables
|
157
|
+
@context.reset_names
|
158
|
+
@context.disable_all_types
|
159
|
+
@context.disable_all_instructions
|
160
|
+
lambda{CodeType.random_value(@context)}.should raise_error
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe "program leaves" do
|
165
|
+
describe "instructions" do
|
166
|
+
it "should work when there are no active instructions" do
|
167
|
+
@context.bind_variable("x",LiteralPoint.new(:int,12))
|
168
|
+
@context.enable(IntType)
|
169
|
+
lambda{CodeType.random_value(@context)}.should_not raise_error
|
170
|
+
end
|
171
|
+
|
172
|
+
it "should default to a sample of the active instructions" do
|
173
|
+
@context.should_receive(:instructions).and_return([IntAddInstruction])
|
174
|
+
CodeType.random_value(@context)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should allow a list of instructions to be passed in as a param" do
|
178
|
+
lambda{CodeType.random_value(@context,:instructions => [IntAddInstruction])}.should_not raise_error
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
describe "channels" do
|
183
|
+
it "should work when there are no active channels" do
|
184
|
+
@context.enable(IntAddInstruction)
|
185
|
+
@context.enable(IntType)
|
186
|
+
lambda{CodeType.random_value(@context)}.should_not raise_error
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should default to a sample of active variables and names" do
|
190
|
+
@context.should_receive(:references).and_return(["x"])
|
191
|
+
CodeType.random_value(@context)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should allow a list of channel names to be passed in as a param" do
|
195
|
+
lambda{CodeType.random_value(@context,:references => ["x"])}.should_not raise_error
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe "types" do
|
200
|
+
it "should work when there are no active types" do
|
201
|
+
@context.bind_variable("x",LiteralPoint.new(:int,12))
|
202
|
+
@context.enable(IntAddInstruction)
|
203
|
+
lambda{CodeType.random_value(@context)}.should_not raise_error
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should default to a sample of active types" do
|
207
|
+
@context.should_receive(:types).and_return([IntType])
|
208
|
+
CodeType.random_value(@context)
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should allow a list of types to be passed in as a param" do
|
212
|
+
lambda{CodeType.random_value(@context,:types => [BoolType])}.should_not raise_error
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
describe "roulette_wheel" do
|
221
|
+
it "should take three lists as parameters" do
|
222
|
+
lambda{CodeType.roulette_wheel()}.should raise_error
|
223
|
+
lambda{CodeType.roulette_wheel([1])}.should raise_error
|
224
|
+
lambda{CodeType.roulette_wheel([1],[2])}.should raise_error
|
225
|
+
lambda{CodeType.roulette_wheel([1],[2],[3])}.should_not raise_error
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should map its three lists to (references, instructions, types) respectively" do
|
229
|
+
CodeType.should_receive(:rand).and_return(1)
|
230
|
+
CodeType.roulette_wheel([1],[2],[3]).should == "reference"
|
231
|
+
CodeType.should_receive(:rand).and_return(2)
|
232
|
+
CodeType.roulette_wheel([1],[2],[3]).should == "instruction"
|
233
|
+
CodeType.should_receive(:rand).and_return(3)
|
234
|
+
CodeType.roulette_wheel([1],[2],[3]).should == "sample"
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should raise an exception if a bad value is returned (for next spec)" do
|
238
|
+
CodeType.should_receive(:rand).and_return(99)
|
239
|
+
lambda{CodeType.roulette_wheel([1],[2],[3])}.should raise_error
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should have a uniform probability of picking any item" do
|
243
|
+
CodeType.should_receive(:rand).and_return(1)
|
244
|
+
CodeType.roulette_wheel([1],[2,3],[4,5,6]).should == "reference"
|
245
|
+
CodeType.should_receive(:rand).and_return(3)
|
246
|
+
CodeType.roulette_wheel([1],[2,3],[4,5,6]).should == "instruction"
|
247
|
+
CodeType.should_receive(:rand).and_return(6)
|
248
|
+
CodeType.roulette_wheel([1],[2,3],[4,5,6]).should == "sample"
|
249
|
+
|
250
|
+
# OK here's the logic: if it's one higher, it'll fail because every entry gets exactly one
|
251
|
+
CodeType.should_receive(:rand).and_return(6,7)
|
252
|
+
lambda{CodeType.roulette_wheel([1,2,3],[4,5],[6])}.should_not raise_error
|
253
|
+
lambda{CodeType.roulette_wheel([1,2,3],[4,5],[6])}.should raise_error
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe "erc" do
|
5
|
+
describe "initialization" do
|
6
|
+
it "should take a type name with no default value" do
|
7
|
+
myE = Erc.new("int",11)
|
8
|
+
myE.type.should == :int
|
9
|
+
lambda {Erc.new()}.should raise_error(ArgumentError)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should take an obligatory value param, with no default" do # this is a change of the original specs
|
13
|
+
myE = Erc.new("int",-99999)
|
14
|
+
myE.value.should == -99999
|
15
|
+
lambda{Erc.new("int")}.should raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should set the value as with a LiteralPoint, if it's given" do
|
19
|
+
myE = Erc.new("bool",false)
|
20
|
+
myE.value.should == false
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be a kind of program point" do
|
24
|
+
myE = Erc.new("bool", true)
|
25
|
+
myE.should be_a_kind_of(ProgramPoint)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "converting to a literal" do
|
30
|
+
it "should allow you to cast it to a Literal with the same values" do
|
31
|
+
myE = Erc.new("int", 4)
|
32
|
+
asL = myE.to_literal
|
33
|
+
asL.type.should == :int
|
34
|
+
asL.value.should == 4
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#go" do
|
39
|
+
before(:each) do
|
40
|
+
@ii = Interpreter.new()
|
41
|
+
@ii.clear_stacks
|
42
|
+
@ii.stacks[:int] = Stack.new(:int)
|
43
|
+
@ii.reset("sample int (999)")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should pop the exec stack when an Erc is interpreted" do
|
47
|
+
oldExec = @ii.stacks[:exec].depth
|
48
|
+
@ii.step
|
49
|
+
@ii.stacks[:exec].depth.should == (oldExec-1)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should initialize the right stack for the type of the Erc if it doesn't exist" do
|
53
|
+
@ii.stacks.delete(:int)
|
54
|
+
@ii.step
|
55
|
+
@ii.stacks.should include(:int)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should use the existing stack if it does exist" do
|
59
|
+
@ii.step
|
60
|
+
@ii.stacks[:int].depth.should == 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should push the value onto the right stack" do
|
64
|
+
@ii.stacks[:exec].push(Erc.new("int",3))
|
65
|
+
@ii.stacks[:exec].push(Erc.new("float",2.2))
|
66
|
+
@ii.stacks[:exec].push(Erc.new("bool",false))
|
67
|
+
|
68
|
+
3.times {@ii.step}
|
69
|
+
@ii.stacks.should include(:int)
|
70
|
+
@ii.stacks.should include(:float)
|
71
|
+
@ii.stacks.should include(:bool)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#tidy" do
|
76
|
+
it "should print 'sample type, value' for Erc#tidy" do
|
77
|
+
myE = Erc.new("float", -99.121001)
|
78
|
+
myE.tidy.should == "sample float (-99.121001)"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "randomize" do
|
83
|
+
before(:each) do
|
84
|
+
@ii = Interpreter.new()
|
85
|
+
@ii.enable_all_types
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return one of the active types (not one of the defined types!)" do
|
89
|
+
myErc = LiteralPoint.new("float", -77.89)
|
90
|
+
@ii.disable_all_types
|
91
|
+
@ii.enable(IntType)
|
92
|
+
myErc.randomize(@ii)
|
93
|
+
myErc.type.should == "int"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#any" do
|
98
|
+
before(:each) do
|
99
|
+
@ii = Interpreter.new()
|
100
|
+
@ii.enable_all_types
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should return a new instance, invoking #randomize" do
|
104
|
+
rE = Erc.any(@ii)
|
105
|
+
rE.should be_a_kind_of(Erc)
|
106
|
+
@ii.disable_all_types
|
107
|
+
@ii.enable(BoolType)
|
108
|
+
rE = Erc.any(@ii)
|
109
|
+
rE.type.should == "bool"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "#resample" do
|
114
|
+
it "should change the value only of the calling Erc instance, not its type" do
|
115
|
+
rE = Erc.new("int", 99)
|
116
|
+
rE.should be_a_kind_of(Erc)
|
117
|
+
IntType.should_receive(:any_value).and_return(2)
|
118
|
+
rE.value.should == 99
|
119
|
+
rE.resample
|
120
|
+
rE.value.should == 2
|
121
|
+
|
122
|
+
rE = Erc.new("bool", false)
|
123
|
+
rE.should be_a_kind_of(Erc)
|
124
|
+
BoolType.should_receive(:any_value).and_return(true)
|
125
|
+
rE.value.should == false
|
126
|
+
rE.resample
|
127
|
+
rE.value.should == true
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|