veritas-optimizer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.rvmrc +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +20 -10
- data/Guardfile +22 -0
- data/README.rdoc +2 -0
- data/Rakefile +4 -2
- data/TODO +43 -2
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/roodi.yml +4 -4
- data/lib/veritas/optimizer/aggregate/count.rb +17 -0
- data/lib/veritas/optimizer/aggregate/maximum.rb +17 -0
- data/lib/veritas/optimizer/aggregate/mean.rb +17 -0
- data/lib/veritas/optimizer/aggregate/minimum.rb +17 -0
- data/lib/veritas/optimizer/aggregate/standard_deviation.rb +17 -0
- data/lib/veritas/optimizer/aggregate/sum.rb +17 -0
- data/lib/veritas/optimizer/aggregate/variance.rb +17 -0
- data/lib/veritas/optimizer/aggregate.rb +16 -0
- data/lib/veritas/optimizer/algebra/difference.rb +3 -1
- data/lib/veritas/optimizer/algebra/extension.rb +58 -3
- data/lib/veritas/optimizer/algebra/intersection.rb +3 -1
- data/lib/veritas/optimizer/algebra/join.rb +6 -4
- data/lib/veritas/optimizer/algebra/product.rb +3 -1
- data/lib/veritas/optimizer/algebra/projection.rb +23 -54
- data/lib/veritas/optimizer/algebra/rename.rb +55 -80
- data/lib/veritas/optimizer/algebra/restriction.rb +33 -66
- data/lib/veritas/optimizer/algebra/summarization.rb +161 -3
- data/lib/veritas/optimizer/algebra/union.rb +3 -1
- data/lib/veritas/optimizer/function/binary.rb +124 -0
- data/lib/veritas/optimizer/{logic → function}/connective/binary.rb +48 -102
- data/lib/veritas/optimizer/{logic → function}/connective/conjunction.rb +12 -11
- data/lib/veritas/optimizer/{logic → function}/connective/disjunction.rb +15 -14
- data/lib/veritas/optimizer/function/connective/negation.rb +65 -0
- data/lib/veritas/optimizer/function/numeric/absolute.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/addition.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/division.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/exponentiation.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/modulo.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/multiplication.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/square_root.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/subtraction.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/unary_minus.rb +20 -0
- data/lib/veritas/optimizer/function/numeric/unary_plus.rb +20 -0
- data/lib/veritas/optimizer/function/numeric.rb +34 -0
- data/lib/veritas/optimizer/{logic → function}/predicate/comparable.rb +6 -4
- data/lib/veritas/optimizer/{logic → function}/predicate/enumerable.rb +24 -26
- data/lib/veritas/optimizer/{logic → function}/predicate/equality.rb +6 -6
- data/lib/veritas/optimizer/{logic → function}/predicate/exclusion.rb +6 -16
- data/lib/veritas/optimizer/{logic → function}/predicate/greater_than.rb +6 -5
- data/lib/veritas/optimizer/{logic → function}/predicate/greater_than_or_equal_to.rb +6 -6
- data/lib/veritas/optimizer/{logic → function}/predicate/inclusion.rb +6 -16
- data/lib/veritas/optimizer/{logic → function}/predicate/inequality.rb +6 -6
- data/lib/veritas/optimizer/{logic → function}/predicate/less_than.rb +6 -5
- data/lib/veritas/optimizer/{logic → function}/predicate/less_than_or_equal_to.rb +6 -6
- data/lib/veritas/optimizer/{logic → function}/predicate/match.rb +5 -4
- data/lib/veritas/optimizer/{logic → function}/predicate/no_match.rb +5 -4
- data/lib/veritas/optimizer/function/predicate.rb +61 -0
- data/lib/veritas/optimizer/function/string/length.rb +31 -0
- data/lib/veritas/optimizer/function/unary.rb +86 -0
- data/lib/veritas/optimizer/function.rb +87 -0
- data/lib/veritas/optimizer/optimizable.rb +6 -3
- data/lib/veritas/optimizer/relation/operation/binary.rb +36 -70
- data/lib/veritas/optimizer/relation/operation/limit.rb +1 -9
- data/lib/veritas/optimizer/relation/operation/offset.rb +1 -9
- data/lib/veritas/optimizer/relation/operation/order.rb +1 -9
- data/lib/veritas/optimizer/relation/operation/reverse.rb +1 -9
- data/lib/veritas/optimizer/relation/operation/unary.rb +50 -13
- data/lib/veritas/optimizer/version.rb +1 -1
- data/lib/veritas/optimizer.rb +43 -16
- data/spec/integration/veritas/algebra/difference/optimize_spec.rb +6 -4
- data/spec/integration/veritas/algebra/intersection/optimize_spec.rb +6 -4
- data/spec/integration/veritas/algebra/join/optimize_spec.rb +4 -2
- data/spec/integration/veritas/algebra/product/optimize_spec.rb +2 -0
- data/spec/integration/veritas/algebra/projection/optimize_spec.rb +6 -4
- data/spec/integration/veritas/algebra/rename/optimize_spec.rb +2 -0
- data/spec/integration/veritas/algebra/restriction/optimize_spec.rb +9 -7
- data/spec/integration/veritas/algebra/summarization/optimize_spec.rb +49 -0
- data/spec/integration/veritas/algebra/union/optimize_spec.rb +6 -4
- data/spec/integration/veritas/{logic → function}/connective/conjunction/optimize_spec.rb +33 -31
- data/spec/integration/veritas/{logic → function}/connective/disjunction/optimize_spec.rb +30 -28
- data/spec/integration/veritas/{logic → function}/connective/negation/optimize_spec.rb +7 -5
- data/spec/integration/veritas/{logic/expression → function}/optimize_spec.rb +5 -3
- data/spec/integration/veritas/{logic → function}/predicate/equality/optimize_spec.rb +9 -7
- data/spec/integration/veritas/{logic → function}/predicate/exclusion/optimize_spec.rb +13 -11
- data/spec/integration/veritas/{logic → function}/predicate/greater_than/optimize_spec.rb +17 -15
- data/spec/integration/veritas/{logic → function}/predicate/greater_than_or_equal_to/optimize_spec.rb +17 -15
- data/spec/integration/veritas/{logic → function}/predicate/inclusion/optimize_spec.rb +13 -11
- data/spec/integration/veritas/{logic → function}/predicate/inequality/optimize_spec.rb +9 -7
- data/spec/integration/veritas/{logic → function}/predicate/less_than/optimize_spec.rb +17 -15
- data/spec/integration/veritas/{logic → function}/predicate/less_than_or_equal_to/optimize_spec.rb +17 -15
- data/spec/integration/veritas/relation/empty/optimize_spec.rb +2 -0
- data/spec/integration/veritas/relation/materialized/optimize_spec.rb +2 -0
- data/spec/integration/veritas/relation/operation/limit/optimize_spec.rb +3 -1
- data/spec/integration/veritas/relation/operation/offset/optimize_spec.rb +3 -1
- data/spec/integration/veritas/relation/operation/order/optimize_spec.rb +4 -2
- data/spec/integration/veritas/relation/operation/reverse/optimize_spec.rb +4 -2
- data/spec/integration/veritas/relation/optimize_spec.rb +2 -0
- data/spec/shared/{logic_connective_binary_optimize_behavior.rb → function_connective_binary_optimize_behavior.rb} +14 -12
- data/spec/shared/idempotent_method_behavior.rb +2 -0
- data/spec/shared/optimize_method_behavior.rb +2 -0
- data/spec/support/add_method_missing.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/difference/empty_left/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/difference/empty_right/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/difference/equal_operands/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/extension/extensions_spec.rb +31 -0
- data/spec/unit/veritas/optimizer/algebra/extension/order_operand/optimizable_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/algebra/extension/order_operand/optimize_spec.rb +22 -0
- data/spec/unit/veritas/optimizer/algebra/extension/unoptimized_operand/optimizable_spec.rb +18 -8
- data/spec/unit/veritas/optimizer/algebra/extension/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/algebra/intersection/empty_left/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/intersection/empty_right/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/intersection/equal_operands/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/join/equal_headers/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/join/equal_headers/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/product/table_dee_left/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/product/table_dee_left/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/product/table_dee_right/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/product/table_dee_right/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/projection/empty_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/projection/empty_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/projection/projection_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/projection/projection_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/projection/{set_operand → union_operand}/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/projection/{set_operand → union_operand}/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/algebra/projection/unoptimized_operand/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/projection/unoptimized_operand/optimize_spec.rb +6 -4
- data/spec/unit/veritas/optimizer/algebra/rename/aliases_spec.rb +5 -13
- data/spec/unit/veritas/optimizer/algebra/rename/empty_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/empty_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/limit_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/limit_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/order_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/order_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimizable_spec.rb +17 -7
- data/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/rename_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/rename_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/rename_operand_and_empty_aliases/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/rename_operand_and_empty_aliases/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimize_spec.rb +7 -5
- data/spec/unit/veritas/optimizer/algebra/rename/reverse_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/reverse_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/set_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/set_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/rename/unoptimized_operand/optimizable_spec.rb +7 -20
- data/spec/unit/veritas/optimizer/algebra/rename/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/restriction/contradiction/optimizable_spec.rb +23 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/contradiction/optimize_spec.rb +7 -5
- data/spec/unit/veritas/optimizer/algebra/restriction/order_operand/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/order_operand/optimize_spec.rb +7 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/predicate_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/restriction_operand/optimizable_spec.rb +5 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/restriction_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/set_operand/optimize_spec.rb +5 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/tautology/optimizable_spec.rb +11 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/tautology/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/algebra/restriction/unoptimized_operand/optimizable_spec.rb +7 -5
- data/spec/unit/veritas/optimizer/algebra/restriction/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/empty_operand/class_methods/extension_default_spec.rb +22 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/empty_operand/optimizable_spec.rb +29 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/empty_operand/optimize_spec.rb +47 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimizable_spec.rb +29 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/empty_summarize_per/optimize_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/order_operand/optimizable_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/order_operand/optimize_spec.rb +22 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/summarize_per_spec.rb +29 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/summarizers_spec.rb +31 -0
- data/spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimizable_spec.rb +30 -8
- data/spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimize_spec.rb +12 -9
- data/spec/unit/veritas/optimizer/algebra/union/empty_left/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/union/empty_right/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/algebra/union/equal_operands/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/class_methods/chain_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/function/binary/constant_operands/optimizable_spec.rb +36 -0
- data/spec/unit/veritas/optimizer/function/binary/constant_operands/optimize_spec.rb +18 -0
- data/spec/unit/veritas/optimizer/function/binary/left_spec.rb +28 -0
- data/spec/unit/veritas/optimizer/function/binary/right_spec.rb +28 -0
- data/spec/unit/veritas/optimizer/function/binary/unoptimized_operands/optimizable_spec.rb +37 -0
- data/spec/unit/veritas/optimizer/function/binary/unoptimized_operands/optimize_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/function/class_methods/optimize_functions_spec.rb +26 -0
- data/spec/unit/veritas/optimizer/function/class_methods/optimize_operand_spec.rb +22 -0
- data/spec/unit/veritas/optimizer/function/connective/binary/constant_operands/optimize_spec.rb +16 -0
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/equal_operands/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/equal_operands/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/left_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/redundant_left_operand/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/redundant_left_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/redundant_right_operand/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/redundant_right_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/binary/right_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/function/connective/conjunction/contradiction/optimizable_spec.rb +64 -0
- data/spec/unit/veritas/optimizer/function/connective/conjunction/contradiction/optimize_spec.rb +19 -0
- data/spec/unit/veritas/optimizer/{logic/connective/disjunction/contradiction_left_operand → function/connective/conjunction/left_operand_tautology}/optimizable_spec.rb +9 -7
- data/spec/unit/veritas/optimizer/{logic → function}/connective/conjunction/left_operand_tautology/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/connective/conjunction/optimizable_to_exclusion/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/conjunction/optimizable_to_exclusion/optimize_spec.rb +5 -3
- data/spec/unit/veritas/optimizer/{logic → function}/connective/conjunction/right_operand_tautology/optimizable_spec.rb +6 -4
- data/spec/unit/veritas/optimizer/function/connective/conjunction/right_operand_tautology/optimize_spec.rb +19 -0
- data/spec/unit/veritas/optimizer/{logic/connective/conjunction/left_operand_tautology → function/connective/disjunction/contradiction_left_operand}/optimizable_spec.rb +9 -7
- data/spec/unit/veritas/optimizer/{logic → function}/connective/disjunction/contradiction_left_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/connective/disjunction/contradiction_right_operand/optimizable_spec.rb +6 -4
- data/spec/unit/veritas/optimizer/{logic → function}/connective/disjunction/contradiction_right_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/connective/disjunction/optimizable_to_inclusion/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/connective/disjunction/optimizable_to_inclusion/optimize_spec.rb +5 -3
- data/spec/unit/veritas/optimizer/function/connective/disjunction/tautology/optimizable_spec.rb +64 -0
- data/spec/unit/veritas/optimizer/function/connective/disjunction/tautology/optimize_spec.rb +19 -0
- data/spec/unit/veritas/optimizer/function/connective/negation/constant_operand/optimize_spec.rb +16 -0
- data/spec/unit/veritas/optimizer/function/connective/negation/invertible_operand/optimizable_spec.rb +28 -0
- data/spec/unit/veritas/optimizer/function/connective/negation/invertible_operand/optimize_spec.rb +22 -0
- data/spec/unit/veritas/optimizer/{logic → function}/connective/negation/operand_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/comparable/never_comparable/optimizable_spec.rb +23 -7
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/comparable/never_equivalent/optimizable_spec.rb +23 -7
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/comparable/normalizable_operands/optimizable_spec.rb +7 -5
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/comparable/normalizable_operands/optimize_spec.rb +7 -5
- data/spec/unit/veritas/optimizer/function/predicate/constant_operands/optimize_spec.rb +16 -0
- data/spec/unit/veritas/optimizer/function/predicate/contradiction/optimize_spec.rb +18 -0
- data/spec/unit/veritas/optimizer/function/predicate/enumerable/class_methods/sort_by_value_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/enumerable/empty_right_operand/optimizable_spec.rb +6 -4
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/enumerable/one_right_operand/optimizable_spec.rb +9 -7
- data/spec/unit/veritas/optimizer/{logic/predicate/enumerable/unoptimized_operand → function/predicate/enumerable/unoptimized_operands}/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic/predicate/enumerable/unoptimized_operand → function/predicate/enumerable/unoptimized_operands}/optimize_spec.rb +18 -5
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/equality/tautology/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/exclusion/empty_right_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/exclusion/one_right_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/greater_than/contradiction/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/greater_than/tautology/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/greater_than_or_equal_to/contradiction/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/greater_than_or_equal_to/tautology/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/inclusion/empty_right_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/inclusion/one_right_operand/optimize_spec.rb +8 -6
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/inequality/contradiction/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/less_than/contradiction/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/less_than/tautology/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/less_than_or_equal_to/contradiction/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic → function}/predicate/less_than_or_equal_to/tautology/optimizable_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/function/predicate/tautology/optimize_spec.rb +18 -0
- data/spec/unit/veritas/optimizer/function/unary/constant_operand/optimizable_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/function/unary/constant_operand/optimize_spec.rb +18 -0
- data/spec/unit/veritas/optimizer/function/unary/operand_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/function/unary/unoptimized_operand/optimizable_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/function/unary/unoptimized_operand/optimize_spec.rb +18 -0
- data/spec/unit/veritas/optimizer/{logic/predicate → function}/util/class_methods/attribute_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/{logic/predicate → function}/util/class_methods/constant_spec.rb +13 -5
- data/spec/unit/veritas/optimizer/function/util/class_methods/max_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/function/util/class_methods/min_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/operation_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/optimizable/class_methods/optimizer_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/optimizable/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/materialized/empty_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/materialized/empty_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb +2 -4
- data/spec/unit/veritas/optimizer/relation/operation/binary/empty_right/optimizable_spec.rb +2 -4
- data/spec/unit/veritas/optimizer/relation/operation/binary/equal_operands/optimizable_spec.rb +2 -5
- data/spec/unit/veritas/optimizer/relation/operation/binary/left_order_operand/optimizable_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/left_order_operand/optimize_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/left_spec.rb +2 -4
- data/spec/unit/veritas/optimizer/relation/operation/binary/materialized_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/materialized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/right_order_operand/optimizable_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/right_order_operand/optimize_spec.rb +23 -0
- data/spec/unit/veritas/optimizer/relation/operation/binary/right_spec.rb +2 -4
- data/spec/unit/veritas/optimizer/relation/operation/binary/{unoptimized_operand → unoptimized_operands}/optimizable_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/relation/operation/binary/{unoptimized_operand → unoptimized_operands}/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/relation/operation/combination/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/equal_limit_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/equal_limit_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/limit_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/limit_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/zero_limit/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/zero_limit/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/offset_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/offset_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/unoptimized_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/zero_offset/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/offset/zero_offset/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/order/one_limit_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/order/one_limit_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/order/order_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/order/order_operand/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/order_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/order_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/reverse_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/reverse_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/unoptimized_operand/optimizable_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/reverse/unoptimized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/empty_operand/optimizable_spec.rb +5 -2
- data/spec/unit/veritas/optimizer/relation/operation/unary/empty_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/header_spec.rb +15 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/materialized_operand/optimizable_spec.rb +5 -2
- data/spec/unit/veritas/optimizer/relation/operation/unary/materialized_operand/optimize_spec.rb +2 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/operand_spec.rb +8 -5
- data/spec/unit/veritas/optimizer/relation/operation/unary/order_operand/optimizable_spec.rb +28 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/order_operand/optimize_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/unchanged_header/optimizable_spec.rb +24 -0
- data/spec/unit/veritas/optimizer/relation/operation/unary/unchanged_header/optimize_spec.rb +14 -0
- data/tasks/metrics/ci.rake +7 -0
- data/tasks/{quality → metrics}/flay.rake +0 -0
- data/tasks/{quality → metrics}/flog.rake +0 -0
- data/tasks/{quality → metrics}/heckle.rake +1 -0
- data/tasks/{quality → metrics}/metric_fu.rake +3 -0
- data/tasks/{quality → metrics}/reek.rake +0 -0
- data/tasks/{quality → metrics}/roodi.rake +0 -0
- data/tasks/{quality → metrics}/yardstick.rake +0 -0
- data/tasks/spec.rake +1 -0
- data/veritas-optimizer.gemspec +183 -352
- metadata +232 -357
- data/lib/veritas/optimizer/logic/connective/negation.rb +0 -71
- data/lib/veritas/optimizer/logic/predicate.rb +0 -177
- data/spec/unit/veritas/optimizer/algebra/projection/header_spec.rb +0 -16
- data/spec/unit/veritas/optimizer/algebra/projection/unchanged_header/optimizable_spec.rb +0 -26
- data/spec/unit/veritas/optimizer/algebra/projection/unchanged_header/optimize_spec.rb +0 -16
- data/spec/unit/veritas/optimizer/algebra/rename/class_methods/union_aliases_spec.rb +0 -27
- data/spec/unit/veritas/optimizer/algebra/rename/header_spec.rb +0 -19
- data/spec/unit/veritas/optimizer/algebra/rename/unchanged_header/optimizable_spec.rb +0 -26
- data/spec/unit/veritas/optimizer/algebra/rename/unchanged_header/optimize_spec.rb +0 -16
- data/spec/unit/veritas/optimizer/algebra/restriction/class_methods/optimize_predicate_spec.rb +0 -31
- data/spec/unit/veritas/optimizer/algebra/restriction/reverse_operand/optimizable_spec.rb +0 -26
- data/spec/unit/veritas/optimizer/algebra/restriction/reverse_operand/optimize_spec.rb +0 -18
- data/spec/unit/veritas/optimizer/logic/connective/binary/unoptimized_operand/optimizable_spec.rb +0 -34
- data/spec/unit/veritas/optimizer/logic/connective/binary/unoptimized_operand/optimize_spec.rb +0 -21
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/contradiction/optimizable_spec.rb +0 -41
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/contradiction/optimize_spec.rb +0 -17
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/right_operand_tautology/optimize_spec.rb +0 -17
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/tautology/optimizable_spec.rb +0 -41
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/tautology/optimize_spec.rb +0 -17
- data/spec/unit/veritas/optimizer/logic/connective/negation/invertible_operand/optimizable_spec.rb +0 -26
- data/spec/unit/veritas/optimizer/logic/connective/negation/invertible_operand/optimize_spec.rb +0 -20
- data/spec/unit/veritas/optimizer/logic/predicate/class_methods/optimize_operand_spec.rb +0 -20
- data/spec/unit/veritas/optimizer/logic/predicate/constant_operands/optimizable_spec.rb +0 -29
- data/spec/unit/veritas/optimizer/logic/predicate/constant_operands/optimize_spec.rb +0 -14
- data/spec/unit/veritas/optimizer/logic/predicate/contradiction/optimize_spec.rb +0 -16
- data/spec/unit/veritas/optimizer/logic/predicate/left_spec.rb +0 -25
- data/spec/unit/veritas/optimizer/logic/predicate/right_spec.rb +0 -25
- data/spec/unit/veritas/optimizer/logic/predicate/tautology/optimize_spec.rb +0 -16
- data/spec/unit/veritas/optimizer/logic/predicate/util/class_methods/max_spec.rb +0 -19
- data/spec/unit/veritas/optimizer/logic/predicate/util/class_methods/min_spec.rb +0 -19
- data/tasks/quality/ci.rake +0 -2
@@ -1,12 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Connective::Disjunction, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
7
9
|
let(:object) { described_class.new(left, right) }
|
8
10
|
|
9
|
-
it_should_behave_like '
|
11
|
+
it_should_behave_like 'Function::Connective::Binary#optimize'
|
10
12
|
|
11
13
|
context 'left and right are predicates' do
|
12
14
|
let(:left) { attribute.gt(1) }
|
@@ -18,13 +20,13 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
18
20
|
end
|
19
21
|
|
20
22
|
context 'left and right are inverse predicates' do
|
21
|
-
let(:left) {
|
22
|
-
let(:right) {
|
23
|
+
let(:left) { Function::Connective::Negation.new(attribute.gt(1)) }
|
24
|
+
let(:right) { Function::Connective::Negation.new(attribute.lt(3)) }
|
23
25
|
|
24
26
|
it { should_not equal(object) }
|
25
27
|
|
26
28
|
it 'reverses the operands' do
|
27
|
-
should eql(
|
29
|
+
should eql(Function::Connective::Disjunction.new(attribute.lte(1), attribute.gte(3)))
|
28
30
|
end
|
29
31
|
|
30
32
|
it_should_behave_like 'an optimize method'
|
@@ -40,8 +42,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
40
42
|
end
|
41
43
|
|
42
44
|
context 'left and right are tautologys' do
|
43
|
-
let(:left) {
|
44
|
-
let(:right) {
|
45
|
+
let(:left) { Function::Proposition::Tautology.instance }
|
46
|
+
let(:right) { Function::Proposition::Tautology.instance }
|
45
47
|
|
46
48
|
it { should equal(left) }
|
47
49
|
|
@@ -49,8 +51,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
49
51
|
end
|
50
52
|
|
51
53
|
context 'left and right are contradictions' do
|
52
|
-
let(:left) {
|
53
|
-
let(:right) {
|
54
|
+
let(:left) { Function::Proposition::Contradiction.instance }
|
55
|
+
let(:right) { Function::Proposition::Contradiction.instance }
|
54
56
|
|
55
57
|
|
56
58
|
it { should equal(left) }
|
@@ -59,8 +61,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
context 'right is a tautology' do
|
62
|
-
let(:left) { attribute.gt(1)
|
63
|
-
let(:right) {
|
64
|
+
let(:left) { attribute.gt(1) }
|
65
|
+
let(:right) { Function::Proposition::Tautology.instance }
|
64
66
|
|
65
67
|
it { should equal(right) }
|
66
68
|
|
@@ -68,8 +70,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
68
70
|
end
|
69
71
|
|
70
72
|
context 'left is a tautology' do
|
71
|
-
let(:left) {
|
72
|
-
let(:right) { attribute.lt(3)
|
73
|
+
let(:left) { Function::Proposition::Tautology.instance }
|
74
|
+
let(:right) { attribute.lt(3) }
|
73
75
|
|
74
76
|
it { should equal(left) }
|
75
77
|
|
@@ -77,8 +79,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
77
79
|
end
|
78
80
|
|
79
81
|
context 'right is a contradiction' do
|
80
|
-
let(:left) { attribute.gt(1)
|
81
|
-
let(:right) {
|
82
|
+
let(:left) { attribute.gt(1) }
|
83
|
+
let(:right) { Function::Proposition::Contradiction.instance }
|
82
84
|
|
83
85
|
it { should equal(left) }
|
84
86
|
|
@@ -86,8 +88,8 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
86
88
|
end
|
87
89
|
|
88
90
|
context 'left is a contradiction' do
|
89
|
-
let(:left) {
|
90
|
-
let(:right) { attribute.lt(3)
|
91
|
+
let(:left) { Function::Proposition::Contradiction.instance }
|
92
|
+
let(:right) { attribute.lt(3) }
|
91
93
|
|
92
94
|
it { should equal(right) }
|
93
95
|
|
@@ -107,7 +109,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
107
109
|
let(:left) { attribute.ne(1) }
|
108
110
|
let(:right) { attribute.ne(3) }
|
109
111
|
|
110
|
-
it { should equal(
|
112
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
111
113
|
|
112
114
|
it_should_behave_like 'an optimize method'
|
113
115
|
end
|
@@ -116,7 +118,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
116
118
|
let(:left) { attribute.eq(1) }
|
117
119
|
let(:right) { attribute.ne(1) }
|
118
120
|
|
119
|
-
it { should equal(
|
121
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
120
122
|
|
121
123
|
it_should_behave_like 'an optimize method'
|
122
124
|
end
|
@@ -125,7 +127,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
125
127
|
let(:left) { attribute.ne(1) }
|
126
128
|
let(:right) { attribute.eq(1) }
|
127
129
|
|
128
|
-
it { should equal(
|
130
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
129
131
|
|
130
132
|
it_should_behave_like 'an optimize method'
|
131
133
|
end
|
@@ -134,7 +136,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
134
136
|
let(:left) { attribute.include([ 1, 2 ]) }
|
135
137
|
let(:right) { attribute.exclude([ 1, 2 ]) }
|
136
138
|
|
137
|
-
it { should equal(
|
139
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
138
140
|
|
139
141
|
it_should_behave_like 'an optimize method'
|
140
142
|
end
|
@@ -143,7 +145,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
143
145
|
let(:left) { attribute.exclude([ 1, 2 ]) }
|
144
146
|
let(:right) { attribute.include([ 1, 2 ]) }
|
145
147
|
|
146
|
-
it { should equal(
|
148
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
147
149
|
|
148
150
|
it_should_behave_like 'an optimize method'
|
149
151
|
end
|
@@ -152,7 +154,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
152
154
|
let(:left) { attribute.gt(1) }
|
153
155
|
let(:right) { attribute.lte(1) }
|
154
156
|
|
155
|
-
it { should equal(
|
157
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
156
158
|
|
157
159
|
it_should_behave_like 'an optimize method'
|
158
160
|
end
|
@@ -161,7 +163,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
161
163
|
let(:left) { attribute.lte(1) }
|
162
164
|
let(:right) { attribute.gt(1) }
|
163
165
|
|
164
|
-
it { should equal(
|
166
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
165
167
|
|
166
168
|
it_should_behave_like 'an optimize method'
|
167
169
|
end
|
@@ -170,7 +172,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
170
172
|
let(:left) { attribute.gte(1) }
|
171
173
|
let(:right) { attribute.lt(1) }
|
172
174
|
|
173
|
-
it { should equal(
|
175
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
174
176
|
|
175
177
|
it_should_behave_like 'an optimize method'
|
176
178
|
end
|
@@ -179,7 +181,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
179
181
|
let(:left) { attribute.lt(1) }
|
180
182
|
let(:right) { attribute.gte(1) }
|
181
183
|
|
182
|
-
it { should equal(
|
184
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
183
185
|
|
184
186
|
it_should_behave_like 'an optimize method'
|
185
187
|
end
|
@@ -189,7 +191,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
189
191
|
let(:left) { attribute.match(/Dan Kubb/) }
|
190
192
|
let(:right) { attribute.no_match(/Dan Kubb/) }
|
191
193
|
|
192
|
-
it { should equal(
|
194
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
193
195
|
|
194
196
|
it_should_behave_like 'an optimize method'
|
195
197
|
end
|
@@ -199,7 +201,7 @@ describe Logic::Connective::Disjunction, '#optimize' do
|
|
199
201
|
let(:left) { attribute.no_match(/Dan Kubb/) }
|
200
202
|
let(:right) { attribute.match(/Dan Kubb/) }
|
201
203
|
|
202
|
-
it { should equal(
|
204
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
203
205
|
|
204
206
|
it_should_behave_like 'an optimize method'
|
205
207
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Connective::Negation, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
@@ -24,17 +26,17 @@ describe Logic::Connective::Negation, '#optimize' do
|
|
24
26
|
end
|
25
27
|
|
26
28
|
context 'operand is a tautology' do
|
27
|
-
let(:operand) {
|
29
|
+
let(:operand) { Function::Proposition::Tautology.instance }
|
28
30
|
|
29
|
-
it { should equal(
|
31
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
30
32
|
|
31
33
|
it_should_behave_like 'an optimize method'
|
32
34
|
end
|
33
35
|
|
34
36
|
context 'operand is a contradiction' do
|
35
|
-
let(:operand) {
|
37
|
+
let(:operand) { Function::Proposition::Contradiction.instance }
|
36
38
|
|
37
|
-
it { should equal(
|
39
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
38
40
|
|
39
41
|
it_should_behave_like 'an optimize method'
|
40
42
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function, '#optimize' do
|
4
6
|
subject { object.optimize(*args) }
|
5
7
|
|
6
|
-
let(:described_class) { Class.new(
|
7
|
-
let(:object) { described_class.new
|
8
|
+
let(:described_class) { Class.new(Function) }
|
9
|
+
let(:object) { described_class.new }
|
8
10
|
|
9
11
|
before do
|
10
12
|
described_class.class_eval do
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Predicate::Equality, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
@@ -10,7 +12,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
10
12
|
|
11
13
|
context 'left and right are attributes' do
|
12
14
|
context 'and equivalent' do
|
13
|
-
it { should equal(
|
15
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
14
16
|
|
15
17
|
it_should_behave_like 'an optimize method'
|
16
18
|
end
|
@@ -18,7 +20,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
18
20
|
context 'and are not joinable' do
|
19
21
|
let(:right) { Attribute::String.new(:other) }
|
20
22
|
|
21
|
-
it { should equal(
|
23
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
22
24
|
|
23
25
|
it_should_behave_like 'an optimize method'
|
24
26
|
end
|
@@ -44,7 +46,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
44
46
|
context 'right is an invalid value' do
|
45
47
|
let(:right) { 'a' }
|
46
48
|
|
47
|
-
it { should equal(
|
49
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
48
50
|
|
49
51
|
it_should_behave_like 'an optimize method'
|
50
52
|
end
|
@@ -62,7 +64,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
62
64
|
context 'left is an invalid value' do
|
63
65
|
let(:left) { 'a' }
|
64
66
|
|
65
|
-
it { should equal(
|
67
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
66
68
|
|
67
69
|
it_should_behave_like 'an optimize method'
|
68
70
|
end
|
@@ -73,7 +75,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
73
75
|
let(:left) { 1 }
|
74
76
|
let(:right) { 1 }
|
75
77
|
|
76
|
-
it { should equal(
|
78
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
77
79
|
|
78
80
|
it_should_behave_like 'an optimize method'
|
79
81
|
end
|
@@ -82,7 +84,7 @@ describe Logic::Predicate::Equality, '#optimize' do
|
|
82
84
|
let(:left) { 1 }
|
83
85
|
let(:right) { 2 }
|
84
86
|
|
85
|
-
it { should equal(
|
87
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
86
88
|
|
87
89
|
it_should_behave_like 'an optimize method'
|
88
90
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Predicate::Exclusion, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
|
-
let(:left) { Attribute::Integer.new(:id)
|
7
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:left) { Attribute::Integer.new(:id, :size => 1..2**31-1) }
|
9
|
+
let(:object) { described_class.new(left, right) }
|
8
10
|
|
9
11
|
context 'right is a Range' do
|
10
12
|
context 'that is inclusive' do
|
11
13
|
context 'and empty' do
|
12
14
|
let(:right) { 1..0 }
|
13
15
|
|
14
|
-
it { should equal(
|
16
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
15
17
|
|
16
18
|
it_should_behave_like 'an optimize method'
|
17
19
|
end
|
@@ -29,7 +31,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
29
31
|
context 'and empty' do
|
30
32
|
let(:right) { 1...1 }
|
31
33
|
|
32
|
-
it { should equal(
|
34
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
33
35
|
|
34
36
|
it_should_behave_like 'an optimize method'
|
35
37
|
end
|
@@ -49,7 +51,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
49
51
|
let(:left) { Attribute::String.new(:string) }
|
50
52
|
let(:right) { 'a'..'z' }
|
51
53
|
|
52
|
-
it { should equal(
|
54
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
53
55
|
|
54
56
|
it_should_behave_like 'an optimize method'
|
55
57
|
end
|
@@ -57,7 +59,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
57
59
|
context 'that is greater than the left range' do
|
58
60
|
let(:right) { 2**31..2**31 }
|
59
61
|
|
60
|
-
it { should equal(
|
62
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
61
63
|
|
62
64
|
it_should_behave_like 'an optimize method'
|
63
65
|
end
|
@@ -65,7 +67,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
65
67
|
context 'that is less than the left range' do
|
66
68
|
let(:right) { -1..-1 }
|
67
69
|
|
68
|
-
it { should equal(
|
70
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
69
71
|
|
70
72
|
it_should_behave_like 'an optimize method'
|
71
73
|
end
|
@@ -75,7 +77,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
75
77
|
context 'that is empty' do
|
76
78
|
let(:right) { [] }
|
77
79
|
|
78
|
-
it { should equal(
|
80
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
79
81
|
|
80
82
|
it_should_behave_like 'an optimize method'
|
81
83
|
end
|
@@ -83,7 +85,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
83
85
|
context 'that is empty after filtering invalid entries' do
|
84
86
|
let(:right) { [ 'a' ] }
|
85
87
|
|
86
|
-
it { should equal(
|
88
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
87
89
|
|
88
90
|
it_should_behave_like 'an optimize method'
|
89
91
|
end
|
@@ -124,7 +126,7 @@ describe Logic::Predicate::Exclusion, '#optimize' do
|
|
124
126
|
context 'right is a nil' do
|
125
127
|
let(:right) { nil }
|
126
128
|
|
127
|
-
it { should equal(
|
129
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
128
130
|
|
129
131
|
it_should_behave_like 'an optimize method'
|
130
132
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Predicate::GreaterThan, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
|
-
let(:attribute) { Attribute::Integer.new(:id, :required => false) }
|
7
|
-
let(:left) { attribute
|
8
|
-
let(:right) { attribute
|
9
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:attribute) { Attribute::Integer.new(:id, :required => false, :size => 1..2**31-1) }
|
9
|
+
let(:left) { attribute }
|
10
|
+
let(:right) { attribute }
|
11
|
+
let(:object) { described_class.new(left, right) }
|
10
12
|
|
11
13
|
context 'left and right are attributes' do
|
12
14
|
context 'and equivalent' do
|
13
|
-
it { should equal(
|
15
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
14
16
|
|
15
17
|
it_should_behave_like 'an optimize method'
|
16
18
|
end
|
@@ -18,7 +20,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
18
20
|
context 'and are not comparable' do
|
19
21
|
let(:right) { Attribute::Float.new(:float) }
|
20
22
|
|
21
|
-
it { should equal(
|
23
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
22
24
|
|
23
25
|
it_should_behave_like 'an optimize method'
|
24
26
|
end
|
@@ -27,7 +29,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
27
29
|
let(:left) { attribute }
|
28
30
|
let(:right) { Attribute::Integer.new(:right, :size => 2**31-1..2**31-1) }
|
29
31
|
|
30
|
-
it { should equal(
|
32
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
31
33
|
|
32
34
|
it_should_behave_like 'an optimize method'
|
33
35
|
end
|
@@ -36,7 +38,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
36
38
|
let(:left) { attribute }
|
37
39
|
let(:right) { Attribute::Integer.new(:right, :size => -1..-1) }
|
38
40
|
|
39
|
-
it { should equal(
|
41
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
40
42
|
|
41
43
|
it_should_behave_like 'an optimize method'
|
42
44
|
end
|
@@ -54,7 +56,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
54
56
|
context 'right is an invalid primitive' do
|
55
57
|
let(:right) { nil }
|
56
58
|
|
57
|
-
it { should equal(
|
59
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
58
60
|
|
59
61
|
it_should_behave_like 'an optimize method'
|
60
62
|
end
|
@@ -62,9 +64,9 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
62
64
|
|
63
65
|
context 'right is an attribute' do
|
64
66
|
context 'left is a valid value' do
|
65
|
-
let(:left) {
|
67
|
+
let(:left) { 2 }
|
66
68
|
|
67
|
-
it { should eql(
|
69
|
+
it { should eql(Function::Predicate::LessThan.new(attribute, 2)) }
|
68
70
|
|
69
71
|
it_should_behave_like 'an optimize method'
|
70
72
|
end
|
@@ -72,7 +74,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
72
74
|
context 'left is an invalid primitive' do
|
73
75
|
let(:left) { nil }
|
74
76
|
|
75
|
-
it { should equal(
|
77
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
76
78
|
|
77
79
|
it_should_behave_like 'an optimize method'
|
78
80
|
end
|
@@ -83,7 +85,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
83
85
|
let(:left) { 2 }
|
84
86
|
let(:right) { 1 }
|
85
87
|
|
86
|
-
it { should equal(
|
88
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
87
89
|
|
88
90
|
it_should_behave_like 'an optimize method'
|
89
91
|
end
|
@@ -92,7 +94,7 @@ describe Logic::Predicate::GreaterThan, '#optimize' do
|
|
92
94
|
let(:left) { 1 }
|
93
95
|
let(:right) { 2 }
|
94
96
|
|
95
|
-
it { should equal(
|
97
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
96
98
|
|
97
99
|
it_should_behave_like 'an optimize method'
|
98
100
|
end
|
data/spec/integration/veritas/{logic → function}/predicate/greater_than_or_equal_to/optimize_spec.rb
RENAMED
@@ -1,16 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
|
-
let(:attribute) { Attribute::Integer.new(:id, :required => false) }
|
7
|
-
let(:left) { attribute
|
8
|
-
let(:right) { attribute
|
9
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:attribute) { Attribute::Integer.new(:id, :required => false, :size => 1..2**31-1) }
|
9
|
+
let(:left) { attribute }
|
10
|
+
let(:right) { attribute }
|
11
|
+
let(:object) { described_class.new(left, right) }
|
10
12
|
|
11
13
|
context 'left and right are attributes' do
|
12
14
|
context 'and equivalent' do
|
13
|
-
it { should equal(
|
15
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
14
16
|
|
15
17
|
it_should_behave_like 'an optimize method'
|
16
18
|
end
|
@@ -18,7 +20,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
18
20
|
context 'and are not comparable' do
|
19
21
|
let(:right) { Attribute::Float.new(:float) }
|
20
22
|
|
21
|
-
it { should equal(
|
23
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
22
24
|
|
23
25
|
it_should_behave_like 'an optimize method'
|
24
26
|
end
|
@@ -27,7 +29,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
27
29
|
let(:left) { attribute }
|
28
30
|
let(:right) { Attribute::Integer.new(:right, :size => 2**31..2**31) }
|
29
31
|
|
30
|
-
it { should equal(
|
32
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
31
33
|
|
32
34
|
it_should_behave_like 'an optimize method'
|
33
35
|
end
|
@@ -36,7 +38,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
36
38
|
let(:left) { attribute }
|
37
39
|
let(:right) { Attribute::Integer.new(:right, :size => -1..-1) }
|
38
40
|
|
39
|
-
it { should equal(
|
41
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
40
42
|
|
41
43
|
it_should_behave_like 'an optimize method'
|
42
44
|
end
|
@@ -44,7 +46,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
44
46
|
|
45
47
|
context 'left is an attribute' do
|
46
48
|
context 'right is a valid value' do
|
47
|
-
let(:right) {
|
49
|
+
let(:right) { 2 }
|
48
50
|
|
49
51
|
it { should equal(object) }
|
50
52
|
|
@@ -54,7 +56,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
54
56
|
context 'right is an invalid primitive' do
|
55
57
|
let(:right) { nil }
|
56
58
|
|
57
|
-
it { should equal(
|
59
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
58
60
|
|
59
61
|
it_should_behave_like 'an optimize method'
|
60
62
|
end
|
@@ -64,7 +66,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
64
66
|
context 'left is a valid value' do
|
65
67
|
let(:left) { 1 }
|
66
68
|
|
67
|
-
it { should eql(
|
69
|
+
it { should eql(Function::Predicate::LessThanOrEqualTo.new(attribute, 1)) }
|
68
70
|
|
69
71
|
it_should_behave_like 'an optimize method'
|
70
72
|
end
|
@@ -72,7 +74,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
72
74
|
context 'left is an invalid primitive' do
|
73
75
|
let(:left) { nil }
|
74
76
|
|
75
|
-
it { should equal(
|
77
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
76
78
|
|
77
79
|
it_should_behave_like 'an optimize method'
|
78
80
|
end
|
@@ -83,7 +85,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
83
85
|
let(:left) { 1 }
|
84
86
|
let(:right) { 1 }
|
85
87
|
|
86
|
-
it { should equal(
|
88
|
+
it { should equal(Function::Proposition::Tautology.instance) }
|
87
89
|
|
88
90
|
it_should_behave_like 'an optimize method'
|
89
91
|
end
|
@@ -92,7 +94,7 @@ describe Logic::Predicate::GreaterThanOrEqualTo, '#optimize' do
|
|
92
94
|
let(:left) { 1 }
|
93
95
|
let(:right) { 2 }
|
94
96
|
|
95
|
-
it { should equal(
|
97
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
96
98
|
|
97
99
|
it_should_behave_like 'an optimize method'
|
98
100
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Function::Predicate::Inclusion, '#optimize' do
|
4
6
|
subject { object.optimize }
|
5
7
|
|
6
|
-
let(:left) { Attribute::Integer.new(:id)
|
7
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:left) { Attribute::Integer.new(:id, :size => 1..2**31-1) }
|
9
|
+
let(:object) { described_class.new(left, right) }
|
8
10
|
|
9
11
|
context 'right is a Range' do
|
10
12
|
context 'that is inclusive' do
|
11
13
|
context 'and empty' do
|
12
14
|
let(:right) { 1..0 }
|
13
15
|
|
14
|
-
it { should equal(
|
16
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
15
17
|
|
16
18
|
it_should_behave_like 'an optimize method'
|
17
19
|
end
|
@@ -29,7 +31,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
29
31
|
context 'and empty' do
|
30
32
|
let(:right) { 1...1 }
|
31
33
|
|
32
|
-
it { should equal(
|
34
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
33
35
|
|
34
36
|
it_should_behave_like 'an optimize method'
|
35
37
|
end
|
@@ -49,7 +51,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
49
51
|
let(:left) { Attribute::String.new(:string) }
|
50
52
|
let(:right) { 'a'..'z' }
|
51
53
|
|
52
|
-
it { should equal(
|
54
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
53
55
|
|
54
56
|
it_should_behave_like 'an optimize method'
|
55
57
|
end
|
@@ -57,7 +59,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
57
59
|
context 'that is greater than the left range' do
|
58
60
|
let(:right) { 2**31..2**31 }
|
59
61
|
|
60
|
-
it { should equal(
|
62
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
61
63
|
|
62
64
|
it_should_behave_like 'an optimize method'
|
63
65
|
end
|
@@ -65,7 +67,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
65
67
|
context 'that is less than the left range' do
|
66
68
|
let(:right) { -1..-1 }
|
67
69
|
|
68
|
-
it { should equal(
|
70
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
69
71
|
|
70
72
|
it_should_behave_like 'an optimize method'
|
71
73
|
end
|
@@ -75,7 +77,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
75
77
|
context 'that is empty' do
|
76
78
|
let(:right) { [] }
|
77
79
|
|
78
|
-
it { should equal(
|
80
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
79
81
|
|
80
82
|
it_should_behave_like 'an optimize method'
|
81
83
|
end
|
@@ -83,7 +85,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
83
85
|
context 'that is empty after filtering invalid entries' do
|
84
86
|
let(:right) { [ 'a' ] }
|
85
87
|
|
86
|
-
it { should equal(
|
88
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
87
89
|
|
88
90
|
it_should_behave_like 'an optimize method'
|
89
91
|
end
|
@@ -124,7 +126,7 @@ describe Logic::Predicate::Inclusion, '#optimize' do
|
|
124
126
|
context 'right is a nil' do
|
125
127
|
let(:right) { nil }
|
126
128
|
|
127
|
-
it { should equal(
|
129
|
+
it { should equal(Function::Proposition::Contradiction.instance) }
|
128
130
|
|
129
131
|
it_should_behave_like 'an optimize method'
|
130
132
|
end
|