cauldron 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +51 -0
- data/Gemfile +6 -3
- data/Gemfile.lock +16 -3
- data/Rakefile +94 -92
- data/VERSION +1 -1
- data/bin/cauldron +2 -2
- data/cauldron.gemspec +15 -451
- data/features/cauldron_new_approach.feature +46 -0
- data/features/step_definitions/cauldron_steps.rb +11 -0
- data/features/step_definitions/terminal_steps.rb +0 -2
- data/features/support/env.rb +11 -1
- data/features/support/hooks.rb +5 -0
- data/lib/cauldron.rb +13 -7
- data/lib/cauldron/array_reverse_operator.rb +39 -0
- data/lib/cauldron/concat_operator.rb +34 -0
- data/lib/cauldron/if_relationship.rb +37 -0
- data/lib/cauldron/numeric_operator.rb +45 -0
- data/lib/cauldron/pot.rb +54 -162
- data/lib/cauldron/relationship.rb +5 -0
- data/lib/cauldron/terminal.rb +4 -60
- data/lib/cauldron/version.rb +3 -0
- data/lib/core/string.rb +21 -0
- data/sandbox.rb +27 -6
- data/spec/cauldron/array_reverse_operator_spec.rb +59 -0
- data/spec/cauldron/concat_operator_spec.rb +89 -0
- data/spec/cauldron/if_relationship_spec.rb +25 -0
- data/spec/cauldron/numeric_operator_spec.rb +70 -0
- data/spec/cauldron/pot_spec.rb +81 -151
- data/spec/cauldron/terminal_spec.rb +1 -39
- data/spec/examples/adding_if_statement.yml +13 -0
- data/spec/examples/simple_head_theory.txt +13 -0
- data/spec/spec_helper.rb +1 -14
- data/tasks/theory_tasks.rake +207 -207
- metadata +92 -532
- data/cauldron/.autotest +0 -23
- data/cauldron/History.txt +0 -6
- data/cauldron/Manifest.txt +0 -8
- data/cauldron/README.txt +0 -57
- data/cauldron/Rakefile +0 -27
- data/cauldron/bin/cauldron +0 -3
- data/cauldron/lib/cauldron.rb +0 -3
- data/cauldron/test/test_cauldron.rb +0 -8
- data/features/cauldron_example_cases.feature +0 -13
- data/features/cauldron_generates_runtime_method.feature +0 -16
- data/features/cauldron_generates_single_paramter_methods.feature +0 -25
- data/features/cauldron_interactive_start_terminal.feature +0 -17
- data/features/cauldron_quit_terminal.feature +0 -9
- data/features/cauldron_start_terminal.feature +0 -12
- data/features/support/method_1.example +0 -3
- data/features/support/method_2.example +0 -6
- data/lib/Chain.rb +0 -771
- data/lib/ChainMapping.rb +0 -172
- data/lib/CodeHandler.rb +0 -513
- data/lib/Mapping.rb +0 -27
- data/lib/MappingValues.rb +0 -24
- data/lib/PartialChain.rb +0 -253
- data/lib/Theory.rb +0 -295
- data/lib/UnifiedChain.rb +0 -351
- data/lib/cauldron/conversion.rb +0 -15
- data/lib/cauldron/demos.rb +0 -280
- data/lib/cauldron/env.rb +0 -1
- data/lib/cauldron/sexp2cauldron.rb +0 -139
- data/lib/cauldron/theory_factory.rb +0 -10
- data/lib/cauldron/util/home.rb +0 -21
- data/lib/cauldron/util/saver.rb +0 -45
- data/lib/core/ActsAsCode.rb +0 -25
- data/lib/core/BlockToken.rb +0 -33
- data/lib/core/CCall.rb +0 -7
- data/lib/core/CTestCase.rb +0 -27
- data/lib/core/ClassMethodCallContainer.rb +0 -58
- data/lib/core/Container.rb +0 -95
- data/lib/core/InstanceCallContainer.rb +0 -298
- data/lib/core/MethodUsage.rb +0 -65
- data/lib/core/PrintVariables.rb +0 -25
- data/lib/core/TheoryGenerator.rb +0 -753
- data/lib/core/Token.rb +0 -7
- data/lib/core/assignment/Assignment.rb +0 -18
- data/lib/core/assignment/Equal.rb +0 -39
- data/lib/core/assignment/Equivalent.rb +0 -20
- data/lib/core/assignment/NotEqual.rb +0 -14
- data/lib/core/call_container/CallContainer.rb +0 -72
- data/lib/core/class_method_call/New.rb +0 -15
- data/lib/core/class_method_call/RuntimeClassMethodCall.rb +0 -31
- data/lib/core/declaration/Declaration.rb +0 -16
- data/lib/core/declaration/LiteralDeclaration.rb +0 -47
- data/lib/core/declaration/VariableDeclaration.rb +0 -59
- data/lib/core/instance_call/ArrayEach.rb +0 -23
- data/lib/core/instance_call/ArrayLength.rb +0 -15
- data/lib/core/instance_call/Chop.rb +0 -19
- data/lib/core/instance_call/Copy.rb +0 -22
- data/lib/core/instance_call/DeclaredVariable.rb +0 -18
- data/lib/core/instance_call/InstanceCall.rb +0 -77
- data/lib/core/instance_call/Params.rb +0 -15
- data/lib/core/instance_call/Push.rb +0 -20
- data/lib/core/instance_call/StringLength.rb +0 -32
- data/lib/core/instance_call/Times.rb +0 -20
- data/lib/core/instance_call/instance_calls.rb +0 -176
- data/lib/core/instance_call/length_equal.rb +0 -15
- data/lib/core/kernal/EvalCall.rb +0 -15
- data/lib/core/kernal/LocalVariablesCall.rb +0 -15
- data/lib/core/literal/Literal.rb +0 -111
- data/lib/core/literal/Raw.rb +0 -23
- data/lib/core/literal/RuntimeMethodLiteral.rb +0 -21
- data/lib/core/literal/StatementLiteral.rb +0 -28
- data/lib/core/method_call/AvailableVariablesCall.rb +0 -25
- data/lib/core/method_call/ClassCall.rb +0 -33
- data/lib/core/method_call/DefCall.rb +0 -72
- data/lib/core/method_call/EvaluateClassCall.rb +0 -29
- data/lib/core/method_call/MethodNameCall.rb +0 -27
- data/lib/core/method_call/ToDeclarationCall.rb +0 -15
- data/lib/core/requirement/Requirement.rb +0 -292
- data/lib/core/runtime_class/ArrayClass.rb +0 -19
- data/lib/core/runtime_class/ClassCallClass.rb +0 -23
- data/lib/core/runtime_class/ClassEvaluationClass.rb +0 -19
- data/lib/core/runtime_class/ClassName.rb +0 -18
- data/lib/core/runtime_class/DefCallClass.rb +0 -21
- data/lib/core/runtime_class/EqualClass.rb +0 -19
- data/lib/core/runtime_class/FixnumClass.rb +0 -15
- data/lib/core/runtime_class/InstanceCallClass.rb +0 -19
- data/lib/core/runtime_class/InstanceCallContainerClass.rb +0 -16
- data/lib/core/runtime_class/InstanceClassCallClass.rb +0 -19
- data/lib/core/runtime_class/LiteralClass.rb +0 -19
- data/lib/core/runtime_class/MethodParameterClass.rb +0 -27
- data/lib/core/runtime_class/MethodUsageClass.rb +0 -27
- data/lib/core/runtime_class/RequirementClass.rb +0 -19
- data/lib/core/runtime_class/ReturnClass.rb +0 -21
- data/lib/core/runtime_class/RuntimeClass.rb +0 -30
- data/lib/core/runtime_class/RuntimeClassClass.rb +0 -19
- data/lib/core/runtime_class/RuntimeMethodClass.rb +0 -34
- data/lib/core/runtime_class/StatementClass.rb +0 -53
- data/lib/core/runtime_class/StringClass.rb +0 -23
- data/lib/core/runtime_class/StringLengthClass.rb +0 -19
- data/lib/core/runtime_class/StringVariableClass.rb +0 -19
- data/lib/core/runtime_class/ThisClass.rb +0 -15
- data/lib/core/runtime_class/UnknownClass.rb +0 -23
- data/lib/core/runtime_class/class_names.rb +0 -95
- data/lib/core/runtime_class/runtime_class.rb +0 -123
- data/lib/core/runtime_method/ActsAsRuntimeMethod.rb +0 -293
- data/lib/core/runtime_method/ParametersContainer.rb +0 -29
- data/lib/core/runtime_method/RealisedRuntimeMethod.rb +0 -94
- data/lib/core/runtime_method/RuntimeMethod.rb +0 -814
- data/lib/core/runtime_method/WriteParameters.rb +0 -35
- data/lib/core/statement/ActsAsStatement.rb +0 -20
- data/lib/core/statement/ArrayAccess.rb +0 -122
- data/lib/core/statement/BlockStatement.rb +0 -348
- data/lib/core/statement/DeclarationStatement.rb +0 -19
- data/lib/core/statement/HackStatement.rb +0 -25
- data/lib/core/statement/HashAccess.rb +0 -18
- data/lib/core/statement/OpenStatement.rb +0 -178
- data/lib/core/statement/RealisedStatement.rb +0 -5
- data/lib/core/statement/SingleLineBlockStatement.rb +0 -39
- data/lib/core/statement/Statement.rb +0 -1091
- data/lib/core/statement/StatementGroup.rb +0 -157
- data/lib/core/statement/StatementStructure2.rb +0 -224
- data/lib/core/statement/TheoryStatement.rb +0 -68
- data/lib/core/statement/TopologicalStatements.rb +0 -34
- data/lib/core/syntax/Addition.rb +0 -26
- data/lib/core/syntax/BlockContainer.rb +0 -102
- data/lib/core/syntax/Boolean.rb +0 -15
- data/lib/core/syntax/Code.rb +0 -11
- data/lib/core/syntax/Do.rb +0 -20
- data/lib/core/syntax/False.rb +0 -12
- data/lib/core/syntax/If.rb +0 -36
- data/lib/core/syntax/Nil.rb +0 -15
- data/lib/core/syntax/Return.rb +0 -33
- data/lib/core/syntax/Subtract.rb +0 -19
- data/lib/core/syntax/This.rb +0 -40
- data/lib/core/syntax/True.rb +0 -20
- data/lib/core/syntax/syntax.rb +0 -24
- data/lib/core/tracking/ActsAsTrackable.rb +0 -65
- data/lib/core/tracking/History.rb +0 -167
- data/lib/core/tracking/RuntimeTrackingMethod.rb +0 -32
- data/lib/core/tracking/Step.rb +0 -52
- data/lib/core/variable/ArrayVariable.rb +0 -76
- data/lib/core/variable/BaseVariable.rb +0 -152
- data/lib/core/variable/BlockVariable.rb +0 -92
- data/lib/core/variable/FixnumVariable.rb +0 -35
- data/lib/core/variable/HistoryVariable.rb +0 -8
- data/lib/core/variable/MethodParameter.rb +0 -179
- data/lib/core/variable/MethodUsageVariable.rb +0 -60
- data/lib/core/variable/NilVariable.rb +0 -29
- data/lib/core/variable/RuntimeMethodParameter.rb +0 -67
- data/lib/core/variable/StatementVariable.rb +0 -72
- data/lib/core/variable/StepVariable.rb +0 -7
- data/lib/core/variable/StringVariable.rb +0 -46
- data/lib/core/variable/TypeVariable.rb +0 -72
- data/lib/core/variable/Unknown.rb +0 -102
- data/lib/core/variable/UnknownVariable.rb +0 -29
- data/lib/core/variable/Variable.rb +0 -70
- data/lib/core/variable/VariableContainer.rb +0 -28
- data/lib/core/variable/VariableIncluded.rb +0 -27
- data/lib/core/variable/VariableReference.rb +0 -85
- data/lib/error/FailedToFindStatementContainerError.rb +0 -7
- data/lib/error/FailedToFindStatementError.rb +0 -7
- data/lib/error/FailedToFindVariableError.rb +0 -7
- data/lib/error/FailedToLiteraliseError.rb +0 -7
- data/lib/error/FailedVariableMatch.rb +0 -7
- data/lib/error/ImproperStatementUsageError.rb +0 -7
- data/lib/error/IncompatiableRequirementsError.rb +0 -7
- data/lib/error/InvalidStatementError.rb +0 -7
- data/lib/error/MethodSizeError.rb +0 -7
- data/lib/error/RuntimeSyntaxError.rb +0 -7
- data/lib/error/UnexpectedStatementTypeError.rb +0 -7
- data/lib/error/UnknownStatementType.rb +0 -7
- data/lib/error/UnliteralisableError.rb +0 -7
- data/lib/implemented_chain.rb +0 -35
- data/lib/intrinsic/IntrinsicLastRuntimeMethod.rb +0 -20
- data/lib/intrinsic/IntrinsicLiteral.rb +0 -26
- data/lib/intrinsic/IntrinsicObject.rb +0 -22
- data/lib/intrinsic/IntrinsicRuntimeMethod.rb +0 -27
- data/lib/intrinsic/IntrinsicTestCases.rb +0 -17
- data/lib/logger/StandardLogger.rb +0 -62
- data/lib/required.rb +0 -222
- data/lib/ruby_code/Array.rb +0 -95
- data/lib/ruby_code/Fixnum.rb +0 -39
- data/lib/ruby_code/Hash.rb +0 -25
- data/lib/ruby_code/NilClass.rb +0 -19
- data/lib/ruby_code/Object.rb +0 -24
- data/lib/ruby_code/String.rb +0 -63
- data/lib/ruby_code/Symbol.rb +0 -7
- data/lib/standard_library/Tasks.rb +0 -12
- data/lib/theories.rb +0 -166
- data/lib/theory/ActionImplementation.rb +0 -17
- data/lib/theory/TheoryAction.rb +0 -100
- data/lib/theory/TheoryChainValidator.rb +0 -103
- data/lib/theory/TheoryComponent.rb +0 -59
- data/lib/theory/TheoryConnector.rb +0 -756
- data/lib/theory/TheoryDependent.rb +0 -135
- data/lib/theory/TheoryImplementation.rb +0 -75
- data/lib/theory/TheoryResult.rb +0 -131
- data/lib/theory/TheoryVariable.rb +0 -63
- data/lib/theory/theory_collection.rb +0 -62
- data/lib/util/ClassEvaluation.rb +0 -44
- data/lib/util/CodeEvaluation.rb +0 -39
- data/lib/util/DeclarationStatementEvaluation.rb +0 -32
- data/lib/util/MethodEvaluation.rb +0 -49
- data/lib/util/MethodTester.rb +0 -71
- data/lib/util/MethodValidation.rb +0 -149
- data/lib/util/MethodWriter.rb +0 -66
- data/lib/util/Parser.rb +0 -305
- data/lib/util/StatementCheck.rb +0 -44
- data/lib/util/StringToTheory.rb +0 -142
- data/lib/util/System.rb +0 -8
- data/spec/cauldron/chain_spec.rb +0 -24
- data/spec/cauldron/demos_spec.rb +0 -30
- data/spec/cauldron/runtime_method_spec.rb +0 -92
- data/spec/cauldron/saver_spec.rb +0 -45
- data/spec/cauldron/sexp_2_cauldron_spec.rb +0 -118
- data/spec/cauldron/theory_action_spec.rb +0 -25
- data/spec/cauldron/theory_connector_spec.rb +0 -52
- data/spec/cauldron/theory_spec.rb +0 -59
- data/spec/cauldron/unified_chain_spec.rb +0 -140
- data/test/fixtures/chains/1/declaration.txt +0 -26
- data/test/fixtures/chains/1/dump +0 -0
- data/test/fixtures/chains/2/declaration.txt +0 -26
- data/test/fixtures/chains/2/dump +0 -0
- data/test/fixtures/chains/3/declaration.txt +0 -26
- data/test/fixtures/chains/3/dump +0 -0
- data/test/fixtures/implementation_results/0/declaration.txt +0 -3
- data/test/fixtures/implementation_results/0/dump +0 -0
- data/test/fixtures/theories/0/declaration.txt +0 -9
- data/test/fixtures/theories/0/desc +0 -10
- data/test/fixtures/theories/0/dump +0 -0
- data/test/fixtures/theories/1/declaration.txt +0 -15
- data/test/fixtures/theories/1/desc +0 -11
- data/test/fixtures/theories/1/dump +0 -0
- data/test/fixtures/theories/10/declaration.txt +0 -23
- data/test/fixtures/theories/10/desc +0 -17
- data/test/fixtures/theories/10/dump +0 -0
- data/test/fixtures/theories/11/declaration.txt +0 -20
- data/test/fixtures/theories/11/desc +0 -14
- data/test/fixtures/theories/11/dump +0 -0
- data/test/fixtures/theories/12/declaration.txt +0 -18
- data/test/fixtures/theories/12/desc +0 -12
- data/test/fixtures/theories/12/dump +0 -0
- data/test/fixtures/theories/13/declaration.txt +0 -24
- data/test/fixtures/theories/13/desc +0 -20
- data/test/fixtures/theories/13/dump +0 -0
- data/test/fixtures/theories/14/declaration.txt +0 -26
- data/test/fixtures/theories/14/desc +0 -20
- data/test/fixtures/theories/14/dump +0 -0
- data/test/fixtures/theories/15/declaration.txt +0 -20
- data/test/fixtures/theories/15/desc +0 -14
- data/test/fixtures/theories/15/dump +0 -0
- data/test/fixtures/theories/16/declaration.txt +0 -30
- data/test/fixtures/theories/16/desc +0 -14
- data/test/fixtures/theories/16/dump +0 -0
- data/test/fixtures/theories/17/declaration.txt +0 -25
- data/test/fixtures/theories/17/desc +0 -11
- data/test/fixtures/theories/17/dump +0 -0
- data/test/fixtures/theories/18/declaration.txt +0 -23
- data/test/fixtures/theories/18/desc +0 -11
- data/test/fixtures/theories/18/dump +0 -0
- data/test/fixtures/theories/19/declaration.txt +0 -23
- data/test/fixtures/theories/19/desc +0 -11
- data/test/fixtures/theories/19/dump +0 -0
- data/test/fixtures/theories/2/declaration.txt +0 -12
- data/test/fixtures/theories/2/desc +0 -10
- data/test/fixtures/theories/2/dump +0 -0
- data/test/fixtures/theories/20/declaration.txt +0 -23
- data/test/fixtures/theories/20/desc +0 -17
- data/test/fixtures/theories/20/dump +0 -0
- data/test/fixtures/theories/3/declaration.txt +0 -19
- data/test/fixtures/theories/3/desc +0 -11
- data/test/fixtures/theories/3/dump +0 -0
- data/test/fixtures/theories/4/declaration.txt +0 -11
- data/test/fixtures/theories/4/desc +0 -11
- data/test/fixtures/theories/4/dump +0 -0
- data/test/fixtures/theories/5/declaration.txt +0 -6
- data/test/fixtures/theories/5/desc +0 -9
- data/test/fixtures/theories/5/dump +0 -0
- data/test/fixtures/theories/6/declaration.txt +0 -13
- data/test/fixtures/theories/6/desc +0 -11
- data/test/fixtures/theories/6/dump +0 -0
- data/test/fixtures/theories/7/declaration.txt +0 -19
- data/test/fixtures/theories/7/desc +0 -11
- data/test/fixtures/theories/7/dump +0 -0
- data/test/fixtures/theories/8/declaration.txt +0 -21
- data/test/fixtures/theories/8/desc +0 -11
- data/test/fixtures/theories/8/dump +0 -0
- data/test/fixtures/theories/9/declaration.txt +0 -24
- data/test/fixtures/theories/9/desc +0 -20
- data/test/fixtures/theories/9/dump +0 -0
- data/test/fixtures/theory_implementations/0/declaration.txt +0 -11
- data/test/fixtures/theory_implementations/0/desc.txt +0 -9
- data/test/fixtures/theory_implementations/0/dump +0 -0
- data/test/fixtures/theory_implementations/0/theory_id +0 -1
- data/test/fixtures/theory_implementations/1/declaration.txt +0 -11
- data/test/fixtures/theory_implementations/1/desc.txt +0 -9
- data/test/fixtures/theory_implementations/1/dump +0 -1
- data/test/fixtures/theory_implementations/1/theory_id +0 -1
- data/test/fixtures/theory_implementations/2/declaration.txt +0 -11
- data/test/fixtures/theory_implementations/2/desc.txt +0 -9
- data/test/fixtures/theory_implementations/2/dump +0 -0
- data/test/fixtures/theory_implementations/2/theory_id +0 -1
- data/test/output/simple_method.txt +0 -5
- data/test/output/test_method/first_possible_method.txt +0 -6
- data/test/output/test_simple_cases/simple_case_01.txt +0 -8
- data/test/output/test_simple_cases/simple_case_02.txt +0 -7
- data/test/output/test_simple_cases/simple_case_03.txt +0 -8
- data/test/output/test_simple_cases/simple_case_04.txt +0 -8
- data/test/output/test_simple_cases/simple_case_05.txt +0 -8
- data/test/output/test_simple_cases/simple_case_06.txt +0 -9
- data/test/output/test_simple_cases/simple_case_07.txt +0 -9
- data/test/output/test_simple_cases/simple_case_08.txt +0 -9
- data/test/tc_describe.rb +0 -46
- data/test/tc_method.rb +0 -130
- data/test/tc_requirement.rb +0 -30
- data/test/tc_suite_complete.rb +0 -26
- data/test/tc_variable.rb +0 -52
- data/test/ts_complete.rb +0 -74
- data/test/ts_stable.rb +0 -81
- data/test/unit/core/declaration/tc_literal_declaration.rb +0 -34
- data/test/unit/core/method_call/tc_class_call.rb +0 -20
- data/test/unit/core/runtime_method/tc_realised_runtime_method.rb +0 -132
- data/test/unit/core/runtime_method/tc_runtime_method.rb +0 -546
- data/test/unit/core/statement/tc_array_access.rb +0 -63
- data/test/unit/core/statement/tc_block_statement.rb +0 -53
- data/test/unit/core/statement/tc_hack_statement.rb +0 -26
- data/test/unit/core/statement/tc_open_statement.rb +0 -79
- data/test/unit/core/statement/tc_statement.rb +0 -483
- data/test/unit/core/statement/tc_statement_group.rb +0 -35
- data/test/unit/core/statement/tc_statement_replace_variable.rb +0 -61
- data/test/unit/core/statement/tc_theory_statement.rb +0 -53
- data/test/unit/core/syntax/tc_block_container.rb +0 -32
- data/test/unit/core/syntax/tc_if_container.rb +0 -39
- data/test/unit/core/tc_class_method_call.rb +0 -34
- data/test/unit/core/tc_container.rb +0 -41
- data/test/unit/core/tc_ctest_case.rb +0 -25
- data/test/unit/core/tc_instance_call_container.rb +0 -93
- data/test/unit/core/tc_literal.rb +0 -30
- data/test/unit/core/tc_theory_generator.rb +0 -336
- data/test/unit/core/tc_theory_generator_heavy.rb +0 -42
- data/test/unit/core/tracking/tc_history.rb +0 -104
- data/test/unit/core/tracking/tc_step.rb +0 -65
- data/test/unit/core/variable/tc_array_variable.rb +0 -61
- data/test/unit/core/variable/tc_block_variable.rb +0 -17
- data/test/unit/core/variable/tc_fixnum_variable.rb +0 -54
- data/test/unit/core/variable/tc_method_parameter_variable.rb +0 -22
- data/test/unit/core/variable/tc_runtime_method_variable.rb +0 -32
- data/test/unit/core/variable/tc_string_variable.rb +0 -37
- data/test/unit/core/variable/tc_unknown.rb +0 -24
- data/test/unit/core/variable/tc_variable_reference.rb +0 -28
- data/test/unit/ruby_code/tc_array.rb +0 -64
- data/test/unit/ruby_code/tc_fixnum.rb +0 -18
- data/test/unit/ruby_code/tc_hash.rb +0 -41
- data/test/unit/ruby_code/tc_string.rb +0 -38
- data/test/unit/tc_chain.rb +0 -434
- data/test/unit/tc_chain_mapping.rb +0 -62
- data/test/unit/tc_chain_with_case_1.rb +0 -169
- data/test/unit/tc_instance_call.rb +0 -40
- data/test/unit/tc_method_usage.rb +0 -35
- data/test/unit/tc_pot.rb +0 -124
- data/test/unit/tc_runtime_tracking_method.rb +0 -40
- data/test/unit/tc_theory.rb +0 -531
- data/test/unit/tc_variable_declaration.rb +0 -32
- data/test/unit/theory/tc_theory_action.rb +0 -108
- data/test/unit/theory/tc_theory_action_implementation.rb +0 -23
- data/test/unit/theory/tc_theory_chain_validator.rb +0 -340
- data/test/unit/theory/tc_theory_connector.rb +0 -361
- data/test/unit/theory/tc_theory_dependent.rb +0 -153
- data/test/unit/theory/tc_theory_implementation.rb +0 -137
- data/test/unit/theory/tc_theory_result.rb +0 -112
- data/test/unit/theory/tc_theory_variable.rb +0 -45
- data/test/unit/util/tc_method_validation.rb +0 -101
- data/test/unit/util/tc_parser.rb +0 -110
- data/test/unit/util/tc_string_to_theory.rb +0 -300
- data/test/unit/variable/tc_method_usage_variable.rb +0 -25
- data/tmp/runtime_method_evaluation.rb +0 -16
data/lib/UnifiedChain.rb
DELETED
@@ -1,351 +0,0 @@
|
|
1
|
-
# A unified chain is no longer editable - all the links have been added. Unlike a normal
|
2
|
-
# chain there is no mapping, all the theories should have the correct ids if they are
|
3
|
-
# linked. A unified chain is always complete.
|
4
|
-
#
|
5
|
-
class UnifiedChain
|
6
|
-
|
7
|
-
attr_reader :connections
|
8
|
-
|
9
|
-
def initialize(nodes,connections)
|
10
|
-
@nodes = nodes
|
11
|
-
#pp connections
|
12
|
-
|
13
|
-
@connections = connections
|
14
|
-
@variable_keys = connections.mapping.keys
|
15
|
-
#pp @variable_keys
|
16
|
-
|
17
|
-
raise StandardError.new('chain is not complete ') unless self.complete?
|
18
|
-
end
|
19
|
-
|
20
|
-
def write(tab=0)
|
21
|
-
return @nodes.inject('') {|total,x| total += x.write}
|
22
|
-
end
|
23
|
-
|
24
|
-
def describe(tab=0)
|
25
|
-
return @nodes.inject('') {|total,x| total += x.describe}
|
26
|
-
end
|
27
|
-
|
28
|
-
def copy
|
29
|
-
#return Chain.new(@nodes.copy)
|
30
|
-
return Marshal.load(Marshal.dump(self))
|
31
|
-
end
|
32
|
-
|
33
|
-
# Returns an array of all the theory variables in the chain. All the
|
34
|
-
# theory variables should be global across the chain.
|
35
|
-
#
|
36
|
-
def theory_variables
|
37
|
-
results = @nodes.inject([]) do |total,theory|
|
38
|
-
total += theory.all_theory_variables.collect {|x| x}
|
39
|
-
total
|
40
|
-
end
|
41
|
-
return results.uniq
|
42
|
-
end
|
43
|
-
|
44
|
-
# Return an implemented version of the chain where all the theory variables have
|
45
|
-
# been replaced with read values.
|
46
|
-
#
|
47
|
-
def implement(mapping)
|
48
|
-
implemented_nodes = @nodes.inject([]) do |total,theory|
|
49
|
-
total << theory.map_to(mapping)
|
50
|
-
end
|
51
|
-
return ImplementedChain.new(implemented_nodes,mapping)
|
52
|
-
end
|
53
|
-
|
54
|
-
def implementation_permuatations2(runtime_method,test_cases,mapping)
|
55
|
-
|
56
|
-
more_mapping = valid_mapping_permutations(runtime_method.copy,test_cases.copy)
|
57
|
-
|
58
|
-
return more_mapping.inject([]) { |total,mapping| total << self.copy.implement(mapping) }
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def valid_mapping_permutations(runtime_method,test_cases)
|
63
|
-
|
64
|
-
# puts '-------------------------------'
|
65
|
-
# puts Cauldron::Util::Saver.save(runtime_method)
|
66
|
-
# puts Cauldron::Util::Saver.save(test_cases)
|
67
|
-
# puts '-------------------------------'
|
68
|
-
# Get the initially available intrinsic values
|
69
|
-
intrinsic_values = [IntrinsicRuntimeMethod.new,IntrinsicTestCases.new]
|
70
|
-
|
71
|
-
total_variables = self.theory_variables.length
|
72
|
-
|
73
|
-
available_values = [IntrinsicRuntimeMethod.new,IntrinsicTestCases.new]
|
74
|
-
|
75
|
-
valid_mappings = [{}]
|
76
|
-
|
77
|
-
itteration_limit = 9
|
78
|
-
|
79
|
-
@nodes.each_with_index do |node,index|
|
80
|
-
|
81
|
-
valid_mappings = extend_value_mapping_wtih_dependents(
|
82
|
-
valid_mappings,
|
83
|
-
index,
|
84
|
-
node,
|
85
|
-
available_values,
|
86
|
-
test_cases.copy,
|
87
|
-
runtime_method.copy
|
88
|
-
)
|
89
|
-
|
90
|
-
unless node.action.nil?
|
91
|
-
if index == 0
|
92
|
-
chain = partial_chain(1..0)
|
93
|
-
else
|
94
|
-
chain = partial_chain(1..(index-1))
|
95
|
-
end
|
96
|
-
limit = 0
|
97
|
-
until has_all_variables_been_found?(node.action,valid_mappings) or limit > itteration_limit
|
98
|
-
valid_mappings = extend_mapping(valid_mappings,node.action,runtime_method.copy,test_cases.copy,chain,available_values)
|
99
|
-
limit += 1
|
100
|
-
end
|
101
|
-
if limit > itteration_limit
|
102
|
-
puts 'Chain saved '+Cauldron::Util::Saver.save(self)
|
103
|
-
puts 'Is chain complete: '+complete?.to_s
|
104
|
-
raise StandardError.new('Unable to resolve action: '+"\n"+node.action.write)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
valid_mappings = extend_value_mapping_with_result(valid_mappings,index,node,available_values,test_cases.copy,runtime_method.copy)
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
return valid_mappings.collect {|x| Mapping.new(x)}
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
def extend_value_mapping_with_result(valid_mappings,index,node,available_values,test_cases,runtime_method)
|
117
|
-
itteration_limit = 3
|
118
|
-
node.results.each do |result|
|
119
|
-
chain = partial_chain(0..index)
|
120
|
-
limit = 0
|
121
|
-
until has_all_variables_been_found?(result,valid_mappings) or limit > itteration_limit
|
122
|
-
valid_mappings = extend_mapping(valid_mappings,result,runtime_method.copy,test_cases.copy,chain,available_values)
|
123
|
-
limit += 1
|
124
|
-
end
|
125
|
-
end
|
126
|
-
return valid_mappings
|
127
|
-
end
|
128
|
-
|
129
|
-
def extend_value_mapping_wtih_dependents(valid_mappings,index,node,available_values,test_cases,runtime_method)
|
130
|
-
itteration_limit = 6
|
131
|
-
node.dependents.each do |dependent|
|
132
|
-
if index == 0
|
133
|
-
chain = partial_chain(0..0)
|
134
|
-
else
|
135
|
-
chain = partial_chain(1..(index-1))
|
136
|
-
end
|
137
|
-
limit = 0
|
138
|
-
until has_all_variables_been_found?(dependent,valid_mappings) or limit > itteration_limit
|
139
|
-
valid_mappings = extend_mapping(valid_mappings,dependent,runtime_method.copy,test_cases.copy,chain,available_values)
|
140
|
-
limit += 1
|
141
|
-
end
|
142
|
-
end
|
143
|
-
return valid_mappings
|
144
|
-
end
|
145
|
-
|
146
|
-
def has_all_variables_been_found?(component,mappings)
|
147
|
-
component.theory_variables.each do |var|
|
148
|
-
mappings.each do |m|
|
149
|
-
return false unless m.has_key?(var.theory_variable_id)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
return true
|
153
|
-
end
|
154
|
-
|
155
|
-
def extend_mapping(valid_mappings,component,runtime_method,test_cases,chain,available_values)
|
156
|
-
|
157
|
-
new_mappings = []
|
158
|
-
component.theory_variables.each do |var|
|
159
|
-
|
160
|
-
valid_mappings.each do |mapping|
|
161
|
-
|
162
|
-
implemented_chain = chain.implement(Mapping.new(mapping))
|
163
|
-
implemented_runtime_method = TheoryChainValidator.new.build_method_from_chain(
|
164
|
-
implemented_chain,runtime_method.copy,test_cases.copy
|
165
|
-
)
|
166
|
-
|
167
|
-
possible_values = available_values-mapping.values
|
168
|
-
begin
|
169
|
-
values = intrinsic_values_for_variable(
|
170
|
-
var.theory_variable_id,
|
171
|
-
component,
|
172
|
-
mapping,
|
173
|
-
implemented_runtime_method,
|
174
|
-
test_cases.copy,
|
175
|
-
possible_values
|
176
|
-
)
|
177
|
-
rescue NoMethodError => e
|
178
|
-
valid_mappings = valid_mappings-[mapping]
|
179
|
-
next
|
180
|
-
end
|
181
|
-
values = values.uniq
|
182
|
-
values.each do |value|
|
183
|
-
copied_mapping = mapping.copy
|
184
|
-
copied_mapping[var.theory_variable_id] = value
|
185
|
-
new_mappings << copied_mapping
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
190
|
-
# => QUICK Hack
|
191
|
-
new_mappings = identify_uniq_mappings(new_mappings)
|
192
|
-
longest_mapping = new_mappings.inject(0) do |highest,m|
|
193
|
-
if(m.length > highest)
|
194
|
-
highest = m.length
|
195
|
-
end
|
196
|
-
highest
|
197
|
-
end
|
198
|
-
res = new_mappings.select {|x| x.length == longest_mapping}
|
199
|
-
new_mappings = res
|
200
|
-
|
201
|
-
unless new_mappings.empty?
|
202
|
-
valid_mappings = new_mappings
|
203
|
-
end
|
204
|
-
return valid_mappings
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
def identify_uniq_mappings(mappings)
|
209
|
-
uniq_mappings = []
|
210
|
-
count = mappings.length
|
211
|
-
until mappings.empty?
|
212
|
-
mapping = mappings.shift
|
213
|
-
already_exists = mappings.any? do |x|
|
214
|
-
next false unless x.length == mapping.length
|
215
|
-
next false unless x.keys.sort == mapping.keys.sort
|
216
|
-
all_values_the_same = true
|
217
|
-
x.each do |key,value|
|
218
|
-
if mapping[key].class != value.class
|
219
|
-
all_values_the_same = false
|
220
|
-
end
|
221
|
-
if mapping[key].class == value.class
|
222
|
-
if mapping[key].kind_of?(IntrinsicLiteral)
|
223
|
-
if mapping[key].write != value.write
|
224
|
-
all_values_the_same = false
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
229
|
-
next false unless all_values_the_same
|
230
|
-
next true
|
231
|
-
end
|
232
|
-
unless already_exists
|
233
|
-
uniq_mappings << mapping
|
234
|
-
end
|
235
|
-
end
|
236
|
-
if uniq_mappings.length == 0 && count != 0
|
237
|
-
raise StandardError.new('uniq_mappings should not be 0')
|
238
|
-
end
|
239
|
-
return uniq_mappings
|
240
|
-
end
|
241
|
-
|
242
|
-
def intrinsic_values_for_variable(id,component,mapping,runtime_method,test_cases,intrinsic_values)
|
243
|
-
|
244
|
-
values = []
|
245
|
-
component.statements_with_variable(id).each do |statement|
|
246
|
-
reg = eval('/^var'+id.to_s+'\./')
|
247
|
-
if statement.write.match(reg)
|
248
|
-
|
249
|
-
intrinsic_values.each do |value|
|
250
|
-
temp_mapping = mapping.copy
|
251
|
-
temp_mapping[id] = value
|
252
|
-
# => TODO Not validating the component - e.g. if(var1.kind_of?(RuntimeMethod))
|
253
|
-
if valid_mapping?(runtime_method.copy,test_cases.copy,statement,temp_mapping)
|
254
|
-
values << value
|
255
|
-
end
|
256
|
-
end
|
257
|
-
next
|
258
|
-
end
|
259
|
-
|
260
|
-
# values for index
|
261
|
-
index_values = []
|
262
|
-
intrinsic_statement = statement.map_to(mapping)
|
263
|
-
if intrinsic_statement.select_all {|z| z.kind_of?(TheoryVariable)}.length > 0
|
264
|
-
if m = intrinsic_statement.write.match(/([\w\.]+)\[var(\d)+\]/)
|
265
|
-
method_call = $1
|
266
|
-
if m2 = method_call.match(/var(\d+)/)
|
267
|
-
next
|
268
|
-
end
|
269
|
-
literal = evaluate_statement(method_call,runtime_method.copy,test_cases.copy)
|
270
|
-
literal.length.times do |n|
|
271
|
-
index_values << IntrinsicLiteral.new(n)
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
values += index_values
|
276
|
-
|
277
|
-
variable_values = []
|
278
|
-
intrinsic_values.each do |value|
|
279
|
-
literal = intrinsic_statement.write.gsub(/var(\d)+/,value.write)
|
280
|
-
begin
|
281
|
-
eval literal
|
282
|
-
variable_values << value
|
283
|
-
rescue
|
284
|
-
next
|
285
|
-
end
|
286
|
-
end
|
287
|
-
values += variable_values
|
288
|
-
|
289
|
-
end
|
290
|
-
return values
|
291
|
-
end
|
292
|
-
|
293
|
-
def partial_chain(range)
|
294
|
-
links = @nodes[range].collect {|x| x.copy }
|
295
|
-
PartialChain.new(links)
|
296
|
-
end
|
297
|
-
|
298
|
-
# => TODO This might not be need - use cucumber to check
|
299
|
-
def mapping_permutations(keys,values)
|
300
|
-
values.permutation(keys.length).to_a.inject([]) do |total,value_permutation|
|
301
|
-
total << Hash[*keys.zip(value_permutation).flatten]
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
def valid_mapping?(runtime_method,test_cases,statement,mapping)
|
306
|
-
intrinsic_statement = statement.map_to(mapping)
|
307
|
-
return false unless intrinsic_statement.select_all {|z| z.kind_of?(TheoryVariable)}.length == 0
|
308
|
-
valid_statement?(intrinsic_statement,runtime_method.copy,test_cases.copy)
|
309
|
-
end
|
310
|
-
|
311
|
-
def evaluate_statement(statement,runtime_method,test_cases)
|
312
|
-
eval statement
|
313
|
-
end
|
314
|
-
|
315
|
-
def valid_statement?(statement,runtime_method,test_cases)
|
316
|
-
eval statement.write
|
317
|
-
return true
|
318
|
-
rescue NoMethodError
|
319
|
-
return false
|
320
|
-
end
|
321
|
-
|
322
|
-
# Returns an array of implemented chains using the various value
|
323
|
-
# permutations. Essential what it is looking for is mapping to convert
|
324
|
-
# all the theory variables to intrinsic variables.
|
325
|
-
#
|
326
|
-
# @param runtime_method The runtime method instance that will be populated to
|
327
|
-
# create the solution.<#RuntimeMethod >
|
328
|
-
# @param test_cases The test cases instance containing real values.
|
329
|
-
#
|
330
|
-
def implementation_permuatations(runtime_method,test_cases,mapping)
|
331
|
-
return implementation_permuatations2(runtime_method,test_cases,mapping)
|
332
|
-
end
|
333
|
-
|
334
|
-
# TODO This is a temporary method while I work out how incomplete? chains are being created
|
335
|
-
def complete?
|
336
|
-
@nodes.each do |node|
|
337
|
-
|
338
|
-
# Exclude the current node being considered
|
339
|
-
filtered_nodes = TheoryCollection.new(@nodes.copy - [node])
|
340
|
-
|
341
|
-
node.dependents.each do |dependent|
|
342
|
-
unless filtered_nodes.results.any? {|result| result.write == dependent.write}
|
343
|
-
return false
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
end
|
348
|
-
return true
|
349
|
-
end
|
350
|
-
|
351
|
-
end
|
data/lib/cauldron/conversion.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Cauldron
|
2
|
-
|
3
|
-
module Conversion
|
4
|
-
|
5
|
-
def convert_to_example(values)
|
6
|
-
CTestCase.new(values[0...(values.length-1)],values.last)
|
7
|
-
end
|
8
|
-
|
9
|
-
def separate_values(csv)
|
10
|
-
csv.split(',').inject([]) {|total,x| total << eval(x) }
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
data/lib/cauldron/demos.rb
DELETED
@@ -1,280 +0,0 @@
|
|
1
|
-
module Cauldron
|
2
|
-
|
3
|
-
module Demos
|
4
|
-
|
5
|
-
def convert_to_cauldron_test_cases(cases)
|
6
|
-
cases.inject([]) do |total,x|
|
7
|
-
cauldron_case = CTestCase.new
|
8
|
-
cauldron_case[:params] = x[0]
|
9
|
-
cauldron_case[:output] = x[1]
|
10
|
-
total << cauldron_case
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def demo(id)
|
15
|
-
|
16
|
-
if id == '1'
|
17
|
-
return demo_one
|
18
|
-
end
|
19
|
-
raise StandardError.new('Unable to find demo with id '+id)
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def demo_one
|
24
|
-
|
25
|
-
@demo_1_test_cases = convert_to_cauldron_test_cases(
|
26
|
-
[
|
27
|
-
[['sparky'],'sparky'],
|
28
|
-
[['kel'],'kel']
|
29
|
-
]
|
30
|
-
)
|
31
|
-
|
32
|
-
# Create demo #1 chain
|
33
|
-
# Create the head for the chain
|
34
|
-
head = Theory.new([],nil,[])
|
35
|
-
|
36
|
-
link_one_action = TheoryAction.new(
|
37
|
-
TheoryStatement.new(StringToTheory.run('Statement.new(Return.new,var1.params[var3])')),
|
38
|
-
StringToTheory.run('var1.statement_id')
|
39
|
-
)
|
40
|
-
# NOTE: I need to add one result so the theory can be flagged as complete - I might not need it
|
41
|
-
# to be complete -
|
42
|
-
link_one_result = TheoryResult.new(StringToTheory.run("if(var1.all_pass?(var2))\nreturn true\nend"))
|
43
|
-
link_one = Theory.new([],link_one_action,[link_one_result])
|
44
|
-
chain = Chain.new
|
45
|
-
chain = chain.extension_permutaions(head).first
|
46
|
-
chain = chain.extension_permutaions(
|
47
|
-
link_one,
|
48
|
-
{
|
49
|
-
1=>IntrinsicRuntimeMethod.new,
|
50
|
-
2=>IntrinsicTestCases.new,
|
51
|
-
3=>IntrinsicLiteral.new(0)
|
52
|
-
}
|
53
|
-
).first
|
54
|
-
|
55
|
-
# Now implement the chain
|
56
|
-
implemented_chain = chain.implement
|
57
|
-
|
58
|
-
# TODO It should generate the values too.(TheoryGenerator)
|
59
|
-
return {
|
60
|
-
:initial_method=>RuntimeMethod.new(MethodUsage.new(MethodParameter.new)),
|
61
|
-
:test_cases=>@demo_1_test_cases.copy,
|
62
|
-
:chain=>chain,
|
63
|
-
:values=>{}
|
64
|
-
}
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# => "def method_3(var_0)\n\tif(var_0 == 'fish')\n\t\treturn 'animal'\n\tend\n\treturn 'vegetable'\nend\n"
|
69
|
-
def demo_two
|
70
|
-
@demo_2_test_cases = convert_to_cauldron_test_cases(
|
71
|
-
[
|
72
|
-
[['fish'],'animal'],
|
73
|
-
[['carrot'],'vegtable'],
|
74
|
-
]
|
75
|
-
)
|
76
|
-
# => head = Theory.new([],nil,[])
|
77
|
-
|
78
|
-
# Statementents
|
79
|
-
# => TODO Need a clear way to format theories
|
80
|
-
# => OpenStatement.new(If.new,Container.new(runtime_method.params[var1],Equivalent.new,test_cases[var2][:params][var3]))
|
81
|
-
# => Statement.new(Return.new,test_cases[var2][:result]) (added to the open statement)
|
82
|
-
# => Statement.new(Return.new,test_cases[var6][:result])
|
83
|
-
|
84
|
-
# => TODO Don't actually want to include these connection hacks
|
85
|
-
|
86
|
-
# => HEAD
|
87
|
-
head_result = TheoryResult.new(StringToTheory.run(
|
88
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend")
|
89
|
-
)
|
90
|
-
head_result_2 = TheoryResult.new(StringToTheory.run(
|
91
|
-
"if(var2.length == 2)\nreturn true\nend")
|
92
|
-
)
|
93
|
-
head = Theory.new([],nil,[head_result,head_result_2])
|
94
|
-
|
95
|
-
# => LINK #1
|
96
|
-
link_one_dependent = TheoryDependent.new(StringToTheory.run(
|
97
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
98
|
-
)
|
99
|
-
)
|
100
|
-
link_one_dependent_2 = TheoryDependent.new(StringToTheory.run(
|
101
|
-
"if(var2.length == 2)\nreturn true\nend")
|
102
|
-
)
|
103
|
-
link_one_action = TheoryAction.new(
|
104
|
-
TheoryStatement.new(StringToTheory.run(
|
105
|
-
'OpenStatement.new(TheoryStatement.new(If.new,Container.new(var1.params[var3],Equivalent.new,var2[var4][:params][var5])))'
|
106
|
-
)),
|
107
|
-
StringToTheory.run('var1.statement_id')
|
108
|
-
)
|
109
|
-
link_one_result = TheoryResult.new(StringToTheory.run(
|
110
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
111
|
-
))
|
112
|
-
link_one_result_2 = TheoryResult.new(StringToTheory.run(
|
113
|
-
"if(var2.length == 2)\nreturn true\nend"
|
114
|
-
))
|
115
|
-
link_one_result_3 = TheoryResult.new(StringToTheory.run(
|
116
|
-
"if(var4.kind_of?(Fixnum))\nreturn true\nend"
|
117
|
-
))
|
118
|
-
link_one = Theory.new([link_one_dependent,link_one_dependent_2],link_one_action,[link_one_result,link_one_result_2,link_one_result_3])
|
119
|
-
|
120
|
-
# => LINK #2
|
121
|
-
link_two_dependent = TheoryDependent.new(StringToTheory.run(
|
122
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
123
|
-
))
|
124
|
-
link_two_dependent_2 = TheoryDependent.new(StringToTheory.run(
|
125
|
-
"if(var2.length == 2)\nreturn true\nend"
|
126
|
-
))
|
127
|
-
link_two_dependent_3 = TheoryDependent.new(StringToTheory.run(
|
128
|
-
"if(var4.kind_of?(Fixnum))\nreturn true\nend"
|
129
|
-
))
|
130
|
-
link_two_action = TheoryAction.new(
|
131
|
-
TheoryStatement.new(StringToTheory.run(
|
132
|
-
'Statement.new(Return.new,var2[var4][:output])'
|
133
|
-
)),
|
134
|
-
StringToTheory.run('var1.first.statement_id')
|
135
|
-
)
|
136
|
-
# link_two_result = TheoryResult.new(StringToTheory.run(
|
137
|
-
# "if(var1.history(var2[var4][:params]) == var2[var4][:output])\nreturn true\nend"
|
138
|
-
# ))
|
139
|
-
link_two_result = TheoryResult.new(StringToTheory.run(
|
140
|
-
"if(var2[var4][:params].length == 1)\nreturn true\nend"
|
141
|
-
))
|
142
|
-
# TODO Don't want to have to include this one
|
143
|
-
link_two_result_2 = TheoryResult.new(StringToTheory.run(
|
144
|
-
"if(var6.kind_of?(Fixnum))\nreturn true\nend"
|
145
|
-
))
|
146
|
-
link_two_result_3 = TheoryResult.new(StringToTheory.run(
|
147
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
148
|
-
))
|
149
|
-
|
150
|
-
link_two = Theory.new(
|
151
|
-
[link_two_dependent,link_two_dependent_2,link_two_dependent_3],
|
152
|
-
link_two_action,
|
153
|
-
[link_two_result,link_two_result_2,link_two_result_3]
|
154
|
-
)
|
155
|
-
|
156
|
-
# => LINK #3
|
157
|
-
# link_three_dependent = TheoryDependent.new(StringToTheory.run(
|
158
|
-
# "if(var1.history(var2[var4][:params]) == var2[var4][:output])\nreturn true\nend"
|
159
|
-
# ))
|
160
|
-
link_three_dependent = TheoryDependent.new(StringToTheory.run(
|
161
|
-
"if(var2[var4][:params].length == 1)\nreturn true\nend"
|
162
|
-
))
|
163
|
-
link_three_dependent_2 = TheoryDependent.new(StringToTheory.run(
|
164
|
-
"if(var6.kind_of?(Fixnum))\nreturn true\nend"
|
165
|
-
))
|
166
|
-
link_three_dependent_3 = TheoryDependent.new(StringToTheory.run(
|
167
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
168
|
-
))
|
169
|
-
link_three_action = TheoryAction.new(
|
170
|
-
TheoryStatement.new(
|
171
|
-
StringToTheory.run(
|
172
|
-
'Statement.new(Return.new,var2[var6][:output])'
|
173
|
-
)
|
174
|
-
),
|
175
|
-
StringToTheory.run('var1.statement_id')
|
176
|
-
)
|
177
|
-
#link_three_result = TheoryResult.new(StringToTheory.run(
|
178
|
-
# "if(var1.history(var2[var6][:params]) == var2[var6][:output])\nreturn true\nend"
|
179
|
-
#))
|
180
|
-
link_three_result = TheoryResult.new(StringToTheory.run(
|
181
|
-
"if(var2[var4][:params].length == 1)\nreturn true\nend"
|
182
|
-
))
|
183
|
-
link_three_result_2 = TheoryResult.new(StringToTheory.run(
|
184
|
-
"if(var2.length == 2)\nreturn true\nend"
|
185
|
-
))
|
186
|
-
link_three_result_3 = TheoryResult.new(StringToTheory.run(
|
187
|
-
"if(var1.length == 2)\nreturn true\nend"
|
188
|
-
))
|
189
|
-
link_three = Theory.new(
|
190
|
-
[link_three_dependent,link_three_dependent_2,link_three_dependent_3],
|
191
|
-
link_three_action,
|
192
|
-
[link_three_result,link_three_result_2,link_three_result_3]
|
193
|
-
)
|
194
|
-
|
195
|
-
# => LINK #4
|
196
|
-
#link_four_dependent = TheoryDependent.new(StringToTheory.run(
|
197
|
-
# "if(var1.history(var2[var6][:params]) == var2[var6][:output])\nreturn true\nend"
|
198
|
-
#))
|
199
|
-
link_four_dependent = TheoryDependent.new(StringToTheory.run(
|
200
|
-
"if(var1.kind_of?(RuntimeMethod))\nreturn true\nend"
|
201
|
-
))
|
202
|
-
link_four_dependent_2 = TheoryDependent.new(StringToTheory.run(
|
203
|
-
"if(var2.length == 2)\nreturn true\nend"
|
204
|
-
))
|
205
|
-
link_four_dependent_3 = TheoryDependent.new(StringToTheory.run(
|
206
|
-
"if(var1.length == 2)\nreturn true\nend"
|
207
|
-
))
|
208
|
-
link_four_result = TheoryResult.new(StringToTheory.run(
|
209
|
-
"if(var1.all_pass?(var2))\nreturn true\nend"
|
210
|
-
))
|
211
|
-
link_four = Theory.new(
|
212
|
-
[link_four_dependent,link_four_dependent_2,link_four_dependent_3],
|
213
|
-
nil,
|
214
|
-
[link_four_result]
|
215
|
-
)
|
216
|
-
|
217
|
-
chain = Chain.new
|
218
|
-
chains = chain.extension_permutaions(head)
|
219
|
-
chain = chains.first
|
220
|
-
|
221
|
-
head_id = chain.first.theory_id
|
222
|
-
last_id = chain.last.theory_id
|
223
|
-
|
224
|
-
values = {
|
225
|
-
1=>IntrinsicRuntimeMethod.new,
|
226
|
-
2=>IntrinsicTestCases.new,
|
227
|
-
3=>IntrinsicLiteral.new(0),
|
228
|
-
4=>IntrinsicLiteral.new(0),
|
229
|
-
5=>IntrinsicLiteral.new(0),
|
230
|
-
6=>IntrinsicLiteral.new(1)
|
231
|
-
}
|
232
|
-
|
233
|
-
chains = chain.extension_permutaions(
|
234
|
-
link_one,values
|
235
|
-
)
|
236
|
-
order = [head_id,link_one.theory_id,last_id]
|
237
|
-
chain = chains.detect do |c|
|
238
|
-
c.collect {|t| t.theory_id} == order
|
239
|
-
end
|
240
|
-
|
241
|
-
chains = chain.extension_permutaions(
|
242
|
-
link_two,values
|
243
|
-
)
|
244
|
-
order = [head_id,link_one.theory_id,link_two.theory_id,last_id]
|
245
|
-
chain = chains.detect do |c|
|
246
|
-
c.collect {|t| t.theory_id} == order
|
247
|
-
end
|
248
|
-
|
249
|
-
chains = chain.extension_permutaions(
|
250
|
-
link_three,values
|
251
|
-
)
|
252
|
-
order = [head_id,link_one.theory_id,link_two.theory_id,link_three.theory_id,last_id]
|
253
|
-
chain = chains.detect do |c|
|
254
|
-
c.collect {|t| t.theory_id} == order
|
255
|
-
end
|
256
|
-
|
257
|
-
chains = chain.extension_permutaions(
|
258
|
-
link_four,values
|
259
|
-
)
|
260
|
-
order = [head_id,link_one.theory_id,link_two.theory_id,link_three.theory_id,link_four.theory_id,last_id]
|
261
|
-
chain = chains.detect do |c|
|
262
|
-
c.collect {|t| t.theory_id} == order
|
263
|
-
end
|
264
|
-
|
265
|
-
unified_chain = chain.unify_chain
|
266
|
-
|
267
|
-
implemented_chain = chain.implement
|
268
|
-
|
269
|
-
return {
|
270
|
-
:initial_method=>RuntimeMethod.new(MethodUsage.new(MethodParameter.new)),
|
271
|
-
:test_cases=>@demo_2_test_cases.copy,
|
272
|
-
:chain=>chain,
|
273
|
-
:values=>{}
|
274
|
-
}
|
275
|
-
|
276
|
-
end
|
277
|
-
|
278
|
-
end
|
279
|
-
|
280
|
-
end
|