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,486 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe "IntEqualQInstruction" do
|
5
|
+
before(:each) do
|
6
|
+
@context = Interpreter.new
|
7
|
+
@i1 = IntEqualQInstruction.new(@context)
|
8
|
+
@int1 = LiteralPoint.new("int", 1)
|
9
|
+
@int2 = LiteralPoint.new("int", 2)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have its #context set to that Interpreter instance it's in" do
|
13
|
+
@i1.context.should == @context
|
14
|
+
end
|
15
|
+
|
16
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
17
|
+
it "should respond to \##{methodName}" do
|
18
|
+
@i1.should respond_to(methodName)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should check that there are enough parameters" do
|
23
|
+
6.times {@context.stacks[:int].push(@int1)}
|
24
|
+
@i1.preconditions?.should == true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should raise an error if the preconditions aren't met" do
|
28
|
+
@context.clear_stacks # there are no params at all
|
29
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should successfully run #go only if all preconditions are met" do
|
33
|
+
5.times {@context.stacks[:int].push(@int1)}
|
34
|
+
@i1.should_receive(:cleanup)
|
35
|
+
@i1.go
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should pop all the arguments" do
|
39
|
+
@context.clear_stacks
|
40
|
+
5.times {@context.stacks[:int].push(@int1)}
|
41
|
+
@i1.stub!(:cleanup) # and do nothing
|
42
|
+
@i1.go
|
43
|
+
@context.stacks[:int].depth.should == 3
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should push the result" do
|
47
|
+
@context.clear_stacks
|
48
|
+
@context.stacks[:int].push(@int1)
|
49
|
+
@context.stacks[:int].push(@int1)
|
50
|
+
@context.stacks[:int].push(@int1)
|
51
|
+
@context.stacks[:int].push(@int2)
|
52
|
+
@i1.go
|
53
|
+
@context.stacks[:bool].peek.value.should == false
|
54
|
+
@i1.go
|
55
|
+
@context.stacks[:bool].peek.value.should == true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
describe "IntLessThanQInstruction" do
|
61
|
+
before(:each) do
|
62
|
+
@context = Interpreter.new
|
63
|
+
@i1 = IntLessThanQInstruction.new(@context)
|
64
|
+
@int1 = LiteralPoint.new("int", 1)
|
65
|
+
@int2 = LiteralPoint.new("int", 2)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should have a #context" do
|
69
|
+
@i1.context.should == @context
|
70
|
+
end
|
71
|
+
|
72
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
73
|
+
it "should respond to \##{methodName}" do
|
74
|
+
@i1.should respond_to(methodName)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should check that there are enough parameters" do
|
79
|
+
6.times {@context.stacks[:int].push(@int1)}
|
80
|
+
@i1.preconditions?.should == true
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should raise an error if the preconditions aren't met" do
|
84
|
+
@context.clear_stacks # there are no params at all
|
85
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should successfully run #go only if all preconditions are met" do
|
89
|
+
5.times {@context.stacks[:int].push(@int1)}
|
90
|
+
@i1.should_receive(:cleanup)
|
91
|
+
@i1.go
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should pop all the arguments" do
|
95
|
+
@context.clear_stacks
|
96
|
+
5.times {@context.stacks[:int].push(@int1)}
|
97
|
+
@i1.stub!(:cleanup) # and do nothing
|
98
|
+
@i1.go
|
99
|
+
@context.stacks[:int].depth.should == 3
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should push the result" do
|
103
|
+
@context.clear_stacks
|
104
|
+
@context.stacks[:int].push(@int1)
|
105
|
+
@context.stacks[:int].push(@int1)
|
106
|
+
@i1.go
|
107
|
+
@context.stacks[:bool].peek.value.should == false
|
108
|
+
|
109
|
+
@context.stacks[:int].push(@int1)
|
110
|
+
@context.stacks[:int].push(@int2)
|
111
|
+
@i1.go
|
112
|
+
@context.stacks[:bool].peek.value.should == true
|
113
|
+
|
114
|
+
@context.stacks[:int].push(@int2)
|
115
|
+
@context.stacks[:int].push(@int1)
|
116
|
+
@i1.go
|
117
|
+
@context.stacks[:bool].peek.value.should == false
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
describe "IntGreaterThanQInstruction" do
|
123
|
+
before(:each) do
|
124
|
+
@context = Interpreter.new
|
125
|
+
@i1 = IntGreaterThanQInstruction.new(@context)
|
126
|
+
@int1 = LiteralPoint.new("int", 1)
|
127
|
+
@int2 = LiteralPoint.new("int", 2)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should have its #context set correctly" do
|
131
|
+
@i1.context.should == @context
|
132
|
+
end
|
133
|
+
|
134
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
135
|
+
it "should respond to \##{methodName}" do
|
136
|
+
@i1.should respond_to(methodName)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should check that there are enough parameters" do
|
141
|
+
6.times {@context.stacks[:int].push(@int1)}
|
142
|
+
@i1.preconditions?.should == true
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should raise an error if the preconditions aren't met" do
|
146
|
+
@context.clear_stacks # there are no params at all
|
147
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should successfully run #go only if all preconditions are met" do
|
151
|
+
5.times {@context.stacks[:int].push(@int1)}
|
152
|
+
@i1.should_receive(:cleanup)
|
153
|
+
@i1.go
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should pop all the arguments" do
|
157
|
+
@context.clear_stacks
|
158
|
+
5.times {@context.stacks[:int].push(@int1)}
|
159
|
+
@i1.stub!(:cleanup) # and do nothing
|
160
|
+
@i1.go
|
161
|
+
@context.stacks[:int].depth.should == 3
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should push the result" do
|
165
|
+
@context.clear_stacks
|
166
|
+
@context.stacks[:int].push(@int1)
|
167
|
+
@context.stacks[:int].push(@int1)
|
168
|
+
@i1.go
|
169
|
+
@context.stacks[:bool].peek.value.should == false
|
170
|
+
|
171
|
+
@context.stacks[:int].push(@int1)
|
172
|
+
@context.stacks[:int].push(@int2)
|
173
|
+
@i1.go
|
174
|
+
@context.stacks[:bool].peek.value.should == false
|
175
|
+
|
176
|
+
@context.stacks[:int].push(@int2)
|
177
|
+
@context.stacks[:int].push(@int1)
|
178
|
+
@i1.go
|
179
|
+
@context.stacks[:bool].peek.value.should == true
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
describe "FloatGreaterThanQInstruction" do
|
185
|
+
before(:each) do
|
186
|
+
@context = Interpreter.new
|
187
|
+
@i1 = FloatGreaterThanQInstruction.new(@context)
|
188
|
+
@float1 = LiteralPoint.new("float", 1.0)
|
189
|
+
@float2 = LiteralPoint.new("float", 2.0)
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should have its context set" do
|
193
|
+
@i1.context.should == @context
|
194
|
+
end
|
195
|
+
|
196
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
197
|
+
it "should respond to \##{methodName}" do
|
198
|
+
@i1.should respond_to(methodName)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should check that there are enough parameters" do
|
203
|
+
6.times {@context.stacks[:float].push(@float1)}
|
204
|
+
@i1.preconditions?.should == true
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should raise an error if the preconditions aren't met" do
|
208
|
+
@context.clear_stacks # there are no params at all
|
209
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should successfully run #go only if all preconditions are met" do
|
213
|
+
5.times {@context.stacks[:float].push(@float1)}
|
214
|
+
@i1.should_receive(:cleanup)
|
215
|
+
@i1.go
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should pop all the arguments" do
|
219
|
+
@context.clear_stacks
|
220
|
+
5.times {@context.stacks[:float].push(@float1)}
|
221
|
+
@i1.stub!(:cleanup) # and do nothing
|
222
|
+
@i1.go
|
223
|
+
@context.stacks[:float].depth.should == 3
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should push the result" do
|
227
|
+
@context.clear_stacks
|
228
|
+
@context.stacks[:float].push(@float1)
|
229
|
+
@context.stacks[:float].push(@float1)
|
230
|
+
@i1.go
|
231
|
+
@context.stacks[:bool].peek.value.should == false
|
232
|
+
|
233
|
+
@context.stacks[:float].push(@float1)
|
234
|
+
@context.stacks[:float].push(@float2)
|
235
|
+
@i1.go
|
236
|
+
@context.stacks[:bool].peek.value.should == false
|
237
|
+
|
238
|
+
@context.stacks[:float].push(@float2)
|
239
|
+
@context.stacks[:float].push(@float1)
|
240
|
+
@i1.go
|
241
|
+
@context.stacks[:bool].peek.value.should == true
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
|
246
|
+
describe "FloatLessThanQInstruction" do
|
247
|
+
before(:each) do
|
248
|
+
@context = Interpreter.new
|
249
|
+
@i1 = FloatLessThanQInstruction.new(@context)
|
250
|
+
@float1 = LiteralPoint.new("float", 1.0)
|
251
|
+
@float2 = LiteralPoint.new("float", 2.0)
|
252
|
+
end
|
253
|
+
|
254
|
+
it "should have its context set" do
|
255
|
+
@i1.context.should == @context
|
256
|
+
end
|
257
|
+
|
258
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
259
|
+
it "should respond to \##{methodName}" do
|
260
|
+
@i1.should respond_to(methodName)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should check that there are enough parameters" do
|
265
|
+
6.times {@context.stacks[:float].push(@float1)}
|
266
|
+
@i1.preconditions?.should == true
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should raise an error if the preconditions aren't met" do
|
270
|
+
@context.clear_stacks # there are no params at all
|
271
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should successfully run #go only if all preconditions are met" do
|
275
|
+
5.times {@context.stacks[:float].push(@float1)}
|
276
|
+
@i1.should_receive(:cleanup)
|
277
|
+
@i1.go
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should pop all the arguments" do
|
281
|
+
@context.clear_stacks
|
282
|
+
5.times {@context.stacks[:float].push(@float1)}
|
283
|
+
@i1.stub!(:cleanup) # and do nothing
|
284
|
+
@i1.go
|
285
|
+
@context.stacks[:float].depth.should == 3
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should push the result" do
|
289
|
+
@context.clear_stacks
|
290
|
+
@context.stacks[:float].push(@float1)
|
291
|
+
@context.stacks[:float].push(@float1)
|
292
|
+
@i1.go
|
293
|
+
@context.stacks[:bool].pop.value.should == false
|
294
|
+
|
295
|
+
@context.stacks[:float].push(@float1)
|
296
|
+
@context.stacks[:float].push(@float2)
|
297
|
+
@i1.go
|
298
|
+
@context.stacks[:bool].pop.value.should == true
|
299
|
+
|
300
|
+
@context.stacks[:float].push(@float2)
|
301
|
+
@context.stacks[:float].push(@float1)
|
302
|
+
@i1.go
|
303
|
+
@context.stacks[:bool].pop.value.should == false
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
describe "FloatEqualQInstruction" do
|
309
|
+
before(:each) do
|
310
|
+
@context = Interpreter.new
|
311
|
+
@i1 = FloatEqualQInstruction.new(@context)
|
312
|
+
@float1 = LiteralPoint.new("float", 1.0)
|
313
|
+
@float2 = LiteralPoint.new("float", 2.0)
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should have its #context set to that Interpreter instance it's in" do
|
317
|
+
@i1.context.should == @context
|
318
|
+
end
|
319
|
+
|
320
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
321
|
+
it "should respond to \##{methodName}" do
|
322
|
+
@i1.should respond_to(methodName)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
it "should check that there are enough parameters" do
|
327
|
+
6.times {@context.stacks[:float].push(@float1)}
|
328
|
+
@i1.preconditions?.should == true
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should raise an error if the preconditions aren't met" do
|
332
|
+
@context.clear_stacks # there are no params at all
|
333
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
334
|
+
end
|
335
|
+
|
336
|
+
it "should successfully run #go only if all preconditions are met" do
|
337
|
+
5.times {@context.stacks[:float].push(@float1)}
|
338
|
+
@i1.should_receive(:cleanup)
|
339
|
+
@i1.go
|
340
|
+
end
|
341
|
+
|
342
|
+
it "should pop all the arguments" do
|
343
|
+
@context.clear_stacks
|
344
|
+
5.times {@context.stacks[:float].push(@float1)}
|
345
|
+
@i1.stub!(:cleanup) # and do nothing
|
346
|
+
@i1.go
|
347
|
+
@context.stacks[:float].depth.should == 3
|
348
|
+
end
|
349
|
+
|
350
|
+
it "should push the result" do
|
351
|
+
@context.clear_stacks
|
352
|
+
@context.stacks[:float].push(@float1)
|
353
|
+
@context.stacks[:float].push(@float1)
|
354
|
+
@context.stacks[:float].push(@float1)
|
355
|
+
@context.stacks[:float].push(@float2)
|
356
|
+
@i1.go
|
357
|
+
@context.stacks[:bool].peek.value.should == false
|
358
|
+
@i1.go
|
359
|
+
@context.stacks[:bool].peek.value.should == true
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
|
364
|
+
describe "ExecEqualQInstruction" do
|
365
|
+
before(:each) do
|
366
|
+
@context = Interpreter.new
|
367
|
+
@i1 = ExecEqualQInstruction.new(@context)
|
368
|
+
@thing1 = "block { do int_add sample float(0.5) block { } }"
|
369
|
+
@thing2 = "block {do int_add sample float(0.5) block {}}"
|
370
|
+
@thing3 = "block {do int_add sample float(0.25) block {}}"
|
371
|
+
@context.reset("block {#{@thing1} #{@thing2} #{@thing3} #{@thing2}}")
|
372
|
+
@context.step
|
373
|
+
end
|
374
|
+
|
375
|
+
it "should have its #context set to that Interpreter instance it's in" do
|
376
|
+
@i1.context.should == @context
|
377
|
+
end
|
378
|
+
|
379
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
380
|
+
it "should respond to \##{methodName}" do
|
381
|
+
@i1.should respond_to(methodName)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should check that there are enough parameters" do
|
386
|
+
@i1.preconditions?.should == true
|
387
|
+
end
|
388
|
+
|
389
|
+
it "should raise an error if the preconditions aren't met" do
|
390
|
+
@context.clear_stacks # there are no params at all
|
391
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
392
|
+
end
|
393
|
+
|
394
|
+
it "should push the correct result to the :bool stack" do
|
395
|
+
@i1.go
|
396
|
+
@context.stacks[:bool].peek.value.should == true
|
397
|
+
@i1.go
|
398
|
+
@context.stacks[:bool].peek.value.should == false
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
|
403
|
+
describe "NameEqualQInstruction" do
|
404
|
+
before(:each) do
|
405
|
+
@context = Interpreter.new
|
406
|
+
@i1 = NameEqualQInstruction.new(@context)
|
407
|
+
@thing1 = ChannelPoint.new("x")
|
408
|
+
@thing2 = ChannelPoint.new("x")
|
409
|
+
@thing3 = ChannelPoint.new("not_x")
|
410
|
+
@thing1.go(@context)
|
411
|
+
@thing2.go(@context)
|
412
|
+
@thing3.go(@context)
|
413
|
+
@thing1.go(@context)
|
414
|
+
end
|
415
|
+
|
416
|
+
it "should have its #context set to that Interpreter instance it's in" do
|
417
|
+
@i1.context.should == @context
|
418
|
+
end
|
419
|
+
|
420
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
421
|
+
it "should respond to \##{methodName}" do
|
422
|
+
@i1.should respond_to(methodName)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
it "should check that there are enough parameters" do
|
427
|
+
@i1.preconditions?.should == true
|
428
|
+
end
|
429
|
+
|
430
|
+
it "should raise an error if the preconditions aren't met" do
|
431
|
+
@context.clear_stacks # there are no params at all
|
432
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
433
|
+
end
|
434
|
+
|
435
|
+
it "should push the correct result to the :bool stack" do
|
436
|
+
@i1.go
|
437
|
+
@context.stacks[:bool].peek.value.should == false
|
438
|
+
@i1.go
|
439
|
+
@context.stacks[:bool].peek.value.should == true
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
|
444
|
+
describe CodeEqualQInstruction do
|
445
|
+
before(:each) do
|
446
|
+
@context = Interpreter.new
|
447
|
+
@i1 = CodeEqualQInstruction.new(@context)
|
448
|
+
@thing1 = ChannelPoint.new("x")
|
449
|
+
@thing2 = LiteralPoint.new("int", 991)
|
450
|
+
end
|
451
|
+
|
452
|
+
it "should have its #context set to that Interpreter instance it's in" do
|
453
|
+
@i1.context.should == @context
|
454
|
+
end
|
455
|
+
|
456
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
457
|
+
it "should respond to \##{methodName}" do
|
458
|
+
@i1.should respond_to(methodName)
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
it "should check that there are enough parameters" do
|
463
|
+
@context.stacks[:code].push @thing1
|
464
|
+
@context.stacks[:code].push @thing1
|
465
|
+
@i1.preconditions?.should == true
|
466
|
+
end
|
467
|
+
|
468
|
+
it "should raise an error if the preconditions aren't met" do
|
469
|
+
@context.clear_stacks # there are no params at all
|
470
|
+
lambda{@i1.preconditions?}.should raise_error(Instruction::NotEnoughStackItems)
|
471
|
+
end
|
472
|
+
|
473
|
+
it "should push the correct result to the :bool stack" do
|
474
|
+
@context.stacks[:code].push @thing1
|
475
|
+
@context.stacks[:code].push @thing1
|
476
|
+
@i1.go
|
477
|
+
@context.stacks[:bool].peek.value.should == true
|
478
|
+
|
479
|
+
@context.stacks[:code].push @thing1
|
480
|
+
@context.stacks[:code].push @thing2
|
481
|
+
@i1.go
|
482
|
+
@context.stacks[:bool].peek.value.should == false
|
483
|
+
end
|
484
|
+
|
485
|
+
it "should depend on the tidy listing, not the type of the item on the :code stack"
|
486
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe IntIfInstruction do
|
5
|
+
before(:each) do
|
6
|
+
@context = Interpreter.new
|
7
|
+
@i1 = IntIfInstruction.new(@context)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have the right context" do
|
11
|
+
@i1.context.should == @context
|
12
|
+
end
|
13
|
+
|
14
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
15
|
+
it "should respond to \##{methodName}" do
|
16
|
+
@i1.should respond_to(methodName)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "\#go" do
|
21
|
+
before(:each) do
|
22
|
+
@context = Interpreter.new
|
23
|
+
@i1 = IntIfInstruction.new(@context)
|
24
|
+
@v1 = LiteralPoint.new("int", 1)
|
25
|
+
@v2 = LiteralPoint.new("int", -100)
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "\#preconditions?" do
|
29
|
+
it "should check that there are two items on the target stack and at least one :bool" do
|
30
|
+
@context.stacks[:int].push(@v1)
|
31
|
+
@context.stacks[:int].push(@v2)
|
32
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
33
|
+
@i1.preconditions?.should == true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "\#cleanup" do
|
38
|
+
it "should keep the top :int if the :bool is true, otherwise the second" do
|
39
|
+
@context.stacks[:int].push(@v1)
|
40
|
+
@context.stacks[:int].push(@v2)
|
41
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
42
|
+
@i1.go
|
43
|
+
@context.stacks[:int].depth.should == 1
|
44
|
+
@context.stacks[:int].peek.value.should == 1
|
45
|
+
|
46
|
+
@context.stacks[:int].push(@v1)
|
47
|
+
@context.stacks[:int].push(@v2)
|
48
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", false))
|
49
|
+
@i1.go
|
50
|
+
@context.stacks[:int].peek.value.should == -100
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
describe FloatIfInstruction do
|
58
|
+
before(:each) do
|
59
|
+
@context = Interpreter.new
|
60
|
+
@i1 = FloatIfInstruction.new(@context)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should have the right context" do
|
64
|
+
@i1.context.should == @context
|
65
|
+
end
|
66
|
+
|
67
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
68
|
+
it "should respond to \##{methodName}" do
|
69
|
+
@i1.should respond_to(methodName)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "\#go" do
|
74
|
+
before(:each) do
|
75
|
+
@context = Interpreter.new
|
76
|
+
@i1 = FloatIfInstruction.new(@context)
|
77
|
+
@v1 = LiteralPoint.new("float", 1.0)
|
78
|
+
@v2 = LiteralPoint.new("float", -9.5)
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "\#preconditions?" do
|
82
|
+
it "should check that there are two items on the target stack and at least one :bool" do
|
83
|
+
@context.stacks[:float].push(@v1)
|
84
|
+
@context.stacks[:float].push(@v2)
|
85
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
86
|
+
@i1.preconditions?.should == true
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "\#cleanup" do
|
91
|
+
it "should keep the top :int if the :bool is true, otherwise the second" do
|
92
|
+
@context.stacks[:float].push(@v1)
|
93
|
+
@context.stacks[:float].push(@v2)
|
94
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
95
|
+
@i1.go
|
96
|
+
@context.stacks[:float].depth.should == 1
|
97
|
+
@context.stacks[:float].peek.value.should == 1.0
|
98
|
+
|
99
|
+
@context.stacks[:float].push(@v1)
|
100
|
+
@context.stacks[:float].push(@v2)
|
101
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", false))
|
102
|
+
@i1.go
|
103
|
+
@context.stacks[:float].peek.value.should == -9.5
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
describe ExecIfInstruction do
|
111
|
+
before(:each) do
|
112
|
+
@context = Interpreter.new
|
113
|
+
@i1 = ExecIfInstruction.new(@context)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should have the right context" do
|
117
|
+
@i1.context.should == @context
|
118
|
+
end
|
119
|
+
|
120
|
+
[:preconditions?, :setup, :derive, :cleanup].each do |methodName|
|
121
|
+
it "should respond to \##{methodName}" do
|
122
|
+
@i1.should respond_to(methodName)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "\#go" do
|
127
|
+
before(:each) do
|
128
|
+
@context = Interpreter.new
|
129
|
+
@context.enable(ExecIfInstruction)
|
130
|
+
@i1 = ExecIfInstruction.new(@context)
|
131
|
+
@v1 = LiteralPoint.new("float", 1.0)
|
132
|
+
@v2 = LiteralPoint.new("float", -9.5)
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "\#preconditions?" do
|
136
|
+
it "should check that there are two items on the target stack and at least one :bool" do
|
137
|
+
@context.stacks[:exec].push(@v1)
|
138
|
+
@context.stacks[:exec].push(@v2)
|
139
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
140
|
+
@i1.preconditions?.should == true
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "\#cleanup" do
|
145
|
+
it "should keep the top :exec item if the :bool is true, otherwise the second" do
|
146
|
+
@context.stacks[:exec].push(@v1)
|
147
|
+
@context.stacks[:exec].push(@v2)
|
148
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", true))
|
149
|
+
@i1.go
|
150
|
+
@context.stacks[:exec].entries.each {|i| p i.listing}
|
151
|
+
@context.stacks[:exec].depth.should == 1
|
152
|
+
@context.stacks[:exec].peek.value.should == 1.0
|
153
|
+
|
154
|
+
@context.stacks[:exec].push(@v1)
|
155
|
+
@context.stacks[:exec].push(@v2)
|
156
|
+
@context.stacks[:bool].push(LiteralPoint.new("bool", false))
|
157
|
+
@i1.go
|
158
|
+
@context.stacks[:exec].peek.value.should == -9.5
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|