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,97 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
class MyThingInstruction < Instruction
|
5
|
+
end
|
6
|
+
|
7
|
+
class PirateTalkInstruction < Instruction
|
8
|
+
def go
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "InstructionPoint" do
|
13
|
+
it "should have a name parameter, with no default" do
|
14
|
+
myI = InstructionPoint.new("foo_bar")
|
15
|
+
myI.name.should == "foo_bar"
|
16
|
+
lambda {InstructionPoint.new()}.should raise_error(ArgumentError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a symbol as a name" do
|
20
|
+
myI = InstructionPoint.new("foo_bar")
|
21
|
+
myI.name.should be_a_kind_of(String)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be a kind of program point" do
|
25
|
+
myL = InstructionPoint.new("int_thing")
|
26
|
+
myL.should be_a_kind_of(ProgramPoint)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#tidy" do
|
30
|
+
it "should return 'do x' when the name is 'x'" do
|
31
|
+
myI = InstructionPoint.new("x")
|
32
|
+
myI.tidy.should == "do x"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
[["plant_water","PlantWaterInstruction"],["opinion_greaterthan?", "OpinionGreaterthan?Instruction"]].each do |inp|
|
37
|
+
it "should know the appropriate class name for the Instruction singleton for #{inp}" do
|
38
|
+
pointName = inp[0]
|
39
|
+
cName = inp[1]
|
40
|
+
myI = InstructionPoint.new(pointName)
|
41
|
+
myI.className.should == cName
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
describe "#go" do
|
47
|
+
describe "class lookup" do
|
48
|
+
it "should find the appropriate class (by name), if it exists, in an Interpreter context" do
|
49
|
+
myI = InstructionPoint.new("my_thing")
|
50
|
+
myI.classLookup.should == MyThingInstruction
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should raise a InstructionNotFoundError if the class doesn't exist" do
|
54
|
+
myI = InstructionPoint.new("foo_baz")
|
55
|
+
lambda{myI.classLookup}.should raise_error(InstructionPoint::InstructionNotFoundError)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should delegate #go to the appropriate Instruction Class" do
|
60
|
+
context = Interpreter.new
|
61
|
+
context.enable(IntAddInstruction)
|
62
|
+
context.instructions_library[IntAddInstruction].should_receive(:go)
|
63
|
+
myI = InstructionPoint.new("int_add").go(context)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "randomize" do
|
68
|
+
before(:each) do
|
69
|
+
@context = Interpreter.new
|
70
|
+
@context.enable_all_instructions
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return one of the active instructions" do
|
74
|
+
myInstrP = InstructionPoint.new("float_multiply")
|
75
|
+
@context.disable_all_instructions
|
76
|
+
@context.enable(IntAddInstruction)
|
77
|
+
myInstrP.randomize(@context)
|
78
|
+
myInstrP.name.should == "int_add"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "any" do
|
83
|
+
before(:each) do
|
84
|
+
@context = Interpreter.new
|
85
|
+
@context.enable_all_instructions
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return a new instance of an instruction, invoking randomize" do
|
89
|
+
someI = InstructionPoint.any(@context)
|
90
|
+
someI.should be_a_kind_of(InstructionPoint)
|
91
|
+
@context.disable_all_instructions
|
92
|
+
@context.enable(FloatSubtractInstruction)
|
93
|
+
someI = InstructionPoint.any(@context)
|
94
|
+
someI.name.should == "float_subtract"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
|
3
|
+
include Nudge
|
4
|
+
|
5
|
+
describe "initialization" do
|
6
|
+
before(:each) do
|
7
|
+
@ii = Interpreter.new()
|
8
|
+
@ii.clear_stacks
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have a #parser, which defaults to a new NudgeLanguageParser" do
|
12
|
+
@ii.parser.should be_a_kind_of(NudgeLanguageParser)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have an empty stacks Hash, empty initially" do
|
16
|
+
@ii.stacks.should == {}
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should keep have an empty instructions attribute, a Hash" do
|
20
|
+
@ii.instructions_library.should == Hash.new
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should automatically create an entry if an unmentioned stack is referenced by a method" do
|
24
|
+
lambda{@ii.stacks[:pirate].peek}.should_not raise_error
|
25
|
+
@ii.stacks.should include(:pirate)
|
26
|
+
|
27
|
+
@ii.stacks.should_not include(:ninja)
|
28
|
+
lambda{@ii.stacks[:ninja].depth}.should_not raise_error
|
29
|
+
@ii.stacks.should include(:ninja)
|
30
|
+
|
31
|
+
@ii.stacks.should_not include(:robot)
|
32
|
+
lambda{@ii.stacks[:robot].pop}.should_not raise_error
|
33
|
+
@ii.stacks.should include(:robot)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should respond to #reset(listing) by parsing the listing and pushing it onto its exec stack" do
|
37
|
+
checker = NudgeLanguageParser.new()
|
38
|
+
myCode = "ref x"
|
39
|
+
@ii.reset(myCode)
|
40
|
+
@ii.stacks.should include(:exec)
|
41
|
+
@ii.stacks[:exec].should be_a_kind_of(Stack)
|
42
|
+
@ii.stacks[:exec].depth.should == 1
|
43
|
+
@ii.stacks[:exec].peek.should be_a_kind_of(ChannelPoint)
|
44
|
+
@ii.stacks[:exec].peek.name.should == checker.parse(myCode).to_points.name
|
45
|
+
end
|
46
|
+
|
47
|
+
it "#reset should reset the #steps counter, too" do
|
48
|
+
@ii.steps = 100
|
49
|
+
@ii.reset("channel x")
|
50
|
+
@ii.steps.should == 0
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should load a complex CodeBlock as a single item on the exec stack" do
|
54
|
+
checker = NudgeLanguageParser.new()
|
55
|
+
myCode = "block {\ndo foo\n do bar\n block {\ndo baz}}"
|
56
|
+
@ii.reset(myCode)
|
57
|
+
@ii.stacks.should include(:exec)
|
58
|
+
@ii.stacks[:exec].depth.should == 1
|
59
|
+
whatGotPushed = @ii.stacks[:exec].peek
|
60
|
+
whatGotPushed.should be_a_kind_of(CodeBlock)
|
61
|
+
whatGotPushed.contents.length.should == checker.parse(myCode).to_points.contents.length
|
62
|
+
whatGotPushed.contents[1].name.should == "bar"
|
63
|
+
whatGotPushed.contents[2].contents[0].name.should == "baz"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should accept a listing, which should default to an empty string" do
|
67
|
+
ij = Interpreter.new(program:"literal int(7)")
|
68
|
+
ij.stacks[:exec].peek.should be_a_kind_of(LiteralPoint)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should have an #enable method that works for Instructions, adding them to the #instructions hash" do
|
72
|
+
@ii.instructions_library.should == {}
|
73
|
+
@ii.enable(IntAddInstruction)
|
74
|
+
@ii.instructions_library[IntAddInstruction].should_not== nil
|
75
|
+
@ii.instructions_library[IntAddInstruction].should be_a_kind_of(IntAddInstruction)
|
76
|
+
@ii.instructions_library[IntAddInstruction].context.should == @ii
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should have an #enable_all_instructions method" do
|
80
|
+
@ii.instructions_library.should == {}
|
81
|
+
@ii.enable_all_instructions
|
82
|
+
@ii.instructions_library.keys.should == Instruction.all_instructions
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should have a #disable_all_instructions method" do
|
86
|
+
@ii.enable_all_instructions
|
87
|
+
@ii.instructions_library.should_not == {}
|
88
|
+
@ii.disable_all_instructions
|
89
|
+
@ii.instructions_library.should == {}
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should have a #disable method that removes Instructions from the #instructions hash" do
|
93
|
+
@ii.enable(IntAddInstruction)
|
94
|
+
@ii.instructions_library[IntAddInstruction].should_not == nil
|
95
|
+
@ii.disable(IntAddInstruction)
|
96
|
+
@ii.instructions_library.should_not include(IntAddInstruction)
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "variables table" do
|
100
|
+
it "should be an empty hash initially (by deafult)" do
|
101
|
+
@ii.variables.should == {}
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should create a new entry when #bind_variable is called" do
|
105
|
+
@ii.bind_variable("x",LiteralPoint.new(:int,88))
|
106
|
+
@ii.variables["x"].should be_a_kind_of(LiteralPoint)
|
107
|
+
@ii.variables["x"].type.should == :int
|
108
|
+
@ii.variables["x"].value.should == 88
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should raise an exception if the bound value is anything but a LiteralPoint" do
|
112
|
+
lambda {@ii.bind_variable("x", 88)}.should raise_error(ArgumentError)
|
113
|
+
lambda {@ii.bind_variable("x", [1,2])}.should raise_error(ArgumentError)
|
114
|
+
lambda {@ii.bind_variable("x", nil)}.should raise_error(ArgumentError)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should remove an new entry when #unbind_variable is called" do
|
118
|
+
@ii.bind_variable("x",LiteralPoint.new(:int,88))
|
119
|
+
@ii.variables["x"].value.should == 88
|
120
|
+
@ii.unbind_variable("x")
|
121
|
+
@ii.variables["x"].should == nil
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should be resettable" do
|
125
|
+
@ii.bind_variable("x",LiteralPoint.new(:int,88))
|
126
|
+
@ii.reset_variables
|
127
|
+
@ii.variables.should_not include("x")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "names table" do
|
132
|
+
it "should be an empty hash initially" do
|
133
|
+
@ii.names.should == {}
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should create a new entry when #bind_name is called" do
|
137
|
+
@ii.bind_name("x",LiteralPoint.new(:bool,false))
|
138
|
+
@ii.names["x"].should be_a_kind_of(LiteralPoint)
|
139
|
+
@ii.names["x"].type.should == :bool
|
140
|
+
@ii.names["x"].value.should == false
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should raise an exception if the bound value is anything but a LiteralPoint" do
|
144
|
+
lambda {@ii.bind_name("x", 88)}.should raise_error(ArgumentError)
|
145
|
+
lambda {@ii.bind_name("x", [1,2])}.should raise_error(ArgumentError)
|
146
|
+
lambda {@ii.bind_name("x", nil)}.should raise_error(ArgumentError)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should remove an new entry when #unbind_name is called" do
|
150
|
+
@ii.bind_name("x",LiteralPoint.new(:int,88))
|
151
|
+
@ii.names["x"].value.should == 88
|
152
|
+
@ii.unbind_name("x")
|
153
|
+
@ii.names["x"].should == nil
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should be resettable" do
|
157
|
+
@ii.bind_name("x",LiteralPoint.new(:int,88))
|
158
|
+
@ii.reset_names
|
159
|
+
@ii.names.should_not include("x")
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "references" do
|
164
|
+
it "should return an Array of keys obtained by mergine variables into names (not vice versa)" do
|
165
|
+
@ii.bind_name("x",LiteralPoint.new(:int,88))
|
166
|
+
@ii.bind_variable("y",LiteralPoint.new(:int,88))
|
167
|
+
@ii.bind_name("y",LiteralPoint.new(:bool,false))
|
168
|
+
@ii.references.should == @ii.names.merge(@ii.variables).keys
|
169
|
+
@ii.references.should_not == @ii.variables.merge(@ii.names).keys
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe "Type list" do
|
174
|
+
it "should have a #types attribute whis defaults to NudgeType.all_types" do
|
175
|
+
@ii.types.should == NudgeType.all_types
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should have a #enable_all_types/#disable_all_types methods that turn on and off all active types" do
|
179
|
+
@ii.enable(BoolType)
|
180
|
+
@ii.disable_all_types
|
181
|
+
@ii.types.should_not include(BoolType)
|
182
|
+
@ii.enable_all_types
|
183
|
+
@ii.types.should == NudgeType.all_types
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should have #enable/#disable methods that add and remove the types from #types list" do
|
187
|
+
@ii.enable(IntType)
|
188
|
+
@ii.enable(BoolType)
|
189
|
+
@ii.disable(IntType)
|
190
|
+
@ii.active?(IntType).should == false
|
191
|
+
@ii.active?(BoolType).should == true
|
192
|
+
@ii.enable(IntType)
|
193
|
+
@ii.active?(IntType).should == true
|
194
|
+
@ii.active?(BoolType).should == true
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should only ever have one copy of a type on the list at once" do
|
198
|
+
@ii.disable_all_types
|
199
|
+
@ii.enable(IntType)
|
200
|
+
@ii.enable(IntType)
|
201
|
+
@ii.enable(IntType)
|
202
|
+
@ii.types.length.should == 1
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
describe "stepping" do
|
209
|
+
before(:each) do
|
210
|
+
@ii = Interpreter.new()
|
211
|
+
@ii.clear_stacks
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should step only until the :exec stack is empty (if the PointLimit has not been reached)" do
|
215
|
+
myCode = "block {}"
|
216
|
+
@ii.reset(myCode)
|
217
|
+
lambda{3.times {@ii.step}}.should_not raise_error
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should step only until the stepLimit has not been reached, if the :exec stack is full" do
|
221
|
+
myCode = "block {"*20 + "}"*20
|
222
|
+
@ii.stepLimit = 3
|
223
|
+
@ii.reset(myCode)
|
224
|
+
lambda{15.times {@ii.step}}.should_not raise_error
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should count how many steps are executed" do
|
228
|
+
myCode = "block {"*20 + "}"*20
|
229
|
+
@ii.reset(myCode)
|
230
|
+
11.times {@ii.step}
|
231
|
+
@ii.steps.should == 11
|
232
|
+
11.times {@ii.step}
|
233
|
+
@ii.steps.should == 20
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "running" do
|
239
|
+
before(:each) do
|
240
|
+
@ii = Interpreter.new()
|
241
|
+
@ii.clear_stacks
|
242
|
+
myCode = "block {"*20 + "}"*20
|
243
|
+
@ii.reset(myCode)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should run until the stepLimit has been reached, if the :exec stack isn't empty" do
|
247
|
+
@ii.stepLimit = 9
|
248
|
+
@ii.run
|
249
|
+
@ii.steps.should == 9
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should run until the :exec stack is empty (if the PointLimit has not been reached)" do
|
253
|
+
@ii.run
|
254
|
+
@ii.steps.should == 20
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should do nothing if the :exec stack starts empty" do
|
258
|
+
@ii.reset()
|
259
|
+
@ii.run
|
260
|
+
@ii.steps.should == 0
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
describe "channel setup" do
|
266
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "/../spec_helper")
|
2
|
+
include Nudge
|
3
|
+
|
4
|
+
describe "LiteralPoint" do
|
5
|
+
|
6
|
+
it "should be a kind of program point" do
|
7
|
+
myL = LiteralPoint.new("int", 4)
|
8
|
+
myL.should be_a_kind_of(ProgramPoint)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be initialized with a type and a value, with no defaults" do
|
12
|
+
myL = LiteralPoint.new("int", 4)
|
13
|
+
myL.should be_a_kind_of(LiteralPoint)
|
14
|
+
myL.type.should == :int
|
15
|
+
myL.value.should == 4
|
16
|
+
lambda{LiteralPoint.new()}.should raise_error(ArgumentError)
|
17
|
+
lambda{LiteralPoint.new("bool")}.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should move to the appropriate stack when removed from the exec stack" do
|
21
|
+
ii = Interpreter.new(program:"literal bool (true)")
|
22
|
+
ii.step
|
23
|
+
ii.stacks[:bool].peek.value.should == true
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#go" do
|
27
|
+
before(:each) do
|
28
|
+
@ii = Interpreter.new()
|
29
|
+
@ii.clear_stacks
|
30
|
+
@ii.stacks[:int] = Stack.new(:int)
|
31
|
+
@ii.reset("literal int (999)")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should pop the exec stack when a LiteralPoint is interpreted" do
|
35
|
+
oldExec = @ii.stacks[:exec].depth
|
36
|
+
@ii.step
|
37
|
+
@ii.stacks[:exec].depth.should == (oldExec-1)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should initialize the right stack for the type of the LiteralPoint if it doesn't exist" do
|
41
|
+
@ii.stacks.delete(:int)
|
42
|
+
@ii.step
|
43
|
+
@ii.stacks.should include(:int)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should use the existing stack if it does exist" do
|
47
|
+
@ii.step
|
48
|
+
@ii.stacks[:int].depth.should == 1
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should push the value onto the right stack" do
|
52
|
+
@ii.stacks[:exec].push(LiteralPoint.new("int",3))
|
53
|
+
@ii.stacks[:exec].push(LiteralPoint.new("float",2.2))
|
54
|
+
@ii.stacks[:exec].push(LiteralPoint.new("bool",false))
|
55
|
+
|
56
|
+
3.times {@ii.step}
|
57
|
+
@ii.stacks.should include(:int)
|
58
|
+
@ii.stacks.should include(:float)
|
59
|
+
@ii.stacks.should include(:bool)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#tidy" do
|
64
|
+
it "should print 'literal type, value' for LiteralPoint#tidy" do
|
65
|
+
myL = LiteralPoint.new("float", -99.121001)
|
66
|
+
myL.tidy.should == "literal float (-99.121001)"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "randomize" do
|
71
|
+
before(:each) do
|
72
|
+
@ii = Interpreter.new()
|
73
|
+
@ii.enable_all_types
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return one of the active types (not one of the defined types!)" do
|
77
|
+
myL = LiteralPoint.new("int", 77)
|
78
|
+
@ii.disable_all_types
|
79
|
+
@ii.enable(BoolType)
|
80
|
+
myL.randomize(@ii)
|
81
|
+
myL.type.should == "bool"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "random CodeType should not be a problem" do
|
86
|
+
it "should have a valid code type and a value that parses" do
|
87
|
+
@ii = Interpreter.new()
|
88
|
+
@ii.disable_all_types
|
89
|
+
@ii.disable_all_instructions
|
90
|
+
@ii.enable(CodeType)
|
91
|
+
lambda{LiteralPoint.any(@ii)}.should raise_error(ArgumentError, "Random code cannot be created")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|