alf 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +25 -0
- data/Gemfile +8 -8
- data/Gemfile.lock +22 -20
- data/Rakefile +1 -1
- data/alf.gemspec +31 -30
- data/alf.noespec +11 -9
- data/bin/alf +1 -1
- data/lib/alf/aggregator/avg.rb +39 -0
- data/lib/alf/aggregator/class_methods.rb +32 -14
- data/lib/alf/aggregator/collect.rb +32 -0
- data/lib/alf/aggregator/concat.rb +47 -0
- data/lib/alf/aggregator/count.rb +32 -0
- data/lib/alf/aggregator/{base.rb → instance_methods.rb} +54 -30
- data/lib/alf/aggregator/max.rb +32 -0
- data/lib/alf/aggregator/min.rb +32 -0
- data/lib/alf/aggregator/stddev.rb +25 -0
- data/lib/alf/aggregator/sum.rb +32 -0
- data/lib/alf/aggregator/variance.rb +45 -0
- data/lib/alf/aggregator.rb +51 -0
- data/lib/alf/environment/class_methods.rb +37 -35
- data/lib/alf/environment/folder.rb +26 -28
- data/lib/alf/environment/{base.rb → instance_methods.rb} +8 -19
- data/lib/alf/environment.rb +34 -0
- data/lib/alf/errors.rb +1 -0
- data/lib/alf/iterator/class_methods.rb +0 -2
- data/lib/alf/iterator/proxy.rb +7 -13
- data/lib/alf/iterator.rb +27 -0
- data/lib/alf/lispy/instance_methods.rb +14 -14
- data/lib/alf/lispy.rb +24 -0
- data/lib/alf/loader.rb +1 -1
- data/lib/alf/operator/binary.rb +4 -15
- data/lib/alf/operator/class_methods.rb +33 -83
- data/lib/alf/operator/instance_methods.rb +29 -0
- data/lib/alf/operator/non_relational/autonum.rb +17 -22
- data/lib/alf/operator/non_relational/clip.rb +18 -18
- data/lib/alf/operator/non_relational/coerce.rb +17 -19
- data/lib/alf/operator/non_relational/compact.rb +13 -57
- data/lib/alf/operator/non_relational/defaults.rb +20 -23
- data/lib/alf/operator/non_relational/generator.rb +14 -32
- data/lib/alf/operator/non_relational/sort.rb +16 -20
- data/lib/alf/operator/nullary.rb +0 -9
- data/lib/alf/operator/relational/extend.rb +17 -22
- data/lib/alf/operator/relational/group.rb +16 -27
- data/lib/alf/operator/relational/heading.rb +15 -25
- data/lib/alf/operator/relational/intersect.rb +14 -33
- data/lib/alf/operator/relational/join.rb +15 -103
- data/lib/alf/operator/relational/matching.rb +15 -42
- data/lib/alf/operator/relational/minus.rb +14 -33
- data/lib/alf/operator/relational/not_matching.rb +15 -42
- data/lib/alf/operator/relational/project.rb +20 -20
- data/lib/alf/operator/relational/quota.rb +19 -47
- data/lib/alf/operator/relational/rank.rb +19 -52
- data/lib/alf/operator/relational/rename.rb +16 -17
- data/lib/alf/operator/relational/restrict.rb +16 -18
- data/lib/alf/operator/relational/summarize.rb +19 -75
- data/lib/alf/operator/relational/ungroup.rb +16 -22
- data/lib/alf/operator/relational/union.rb +17 -29
- data/lib/alf/operator/relational/unwrap.rb +17 -19
- data/lib/alf/operator/relational/wrap.rb +18 -20
- data/lib/alf/operator/signature.rb +67 -96
- data/lib/alf/operator/unary.rb +4 -26
- data/lib/alf/operator.rb +68 -0
- data/lib/alf/reader/alf_file.rb +5 -5
- data/lib/alf/reader/class_methods.rb +47 -38
- data/lib/alf/reader/{base.rb → instance_methods.rb} +18 -40
- data/lib/alf/reader/rash.rb +3 -3
- data/lib/alf/reader.rb +37 -0
- data/lib/alf/relation/instance_methods.rb +17 -37
- data/lib/alf/relation.rb +28 -0
- data/lib/alf/renderer/{base.rb → instance_methods.rb} +13 -30
- data/lib/alf/renderer.rb +32 -0
- data/lib/alf/tools/coerce.rb +18 -7
- data/lib/alf/tools/miscellaneous.rb +56 -29
- data/lib/alf/tools/to_lispy.rb +37 -40
- data/lib/alf/tools/to_ruby_literal.rb +24 -7
- data/lib/alf/tools/tuple_handle.rb +27 -17
- data/lib/alf/tools.rb +14 -0
- data/lib/alf/types/attr_list.rb +135 -31
- data/lib/alf/types/attr_name.rb +56 -18
- data/lib/alf/types/boolean.rb +18 -5
- data/lib/alf/types/heading.rb +83 -59
- data/lib/alf/types/ordering.rb +117 -64
- data/lib/alf/types/renaming.rb +73 -33
- data/lib/alf/types/size.rb +57 -0
- data/lib/alf/types/summarization.rb +105 -43
- data/lib/alf/types/tuple_computation.rb +113 -38
- data/lib/alf/types/tuple_expression.rb +122 -31
- data/lib/alf/types/tuple_predicate.rb +64 -40
- data/lib/alf/types.rb +49 -0
- data/lib/alf/version.rb +6 -6
- data/lib/alf-csv/alf/csv/commons.rb +36 -0
- data/lib/alf-csv/alf/csv/reader.rb +33 -0
- data/lib/alf-csv/alf/csv/renderer.rb +38 -0
- data/lib/alf-csv/alf/csv.rb +3 -0
- data/lib/alf-engine/alf/engine/aggregate.rb +44 -0
- data/lib/alf-engine/alf/engine/autonum.rb +45 -0
- data/lib/{alf/operator → alf-engine/alf/engine}/cesure.rb +13 -13
- data/lib/alf-engine/alf/engine/clip.rb +53 -0
- data/lib/alf-engine/alf/engine/coerce.rb +46 -0
- data/lib/alf-engine/alf/engine/cog.rb +7 -0
- data/lib/alf-engine/alf/engine/compact/set.rb +23 -0
- data/lib/alf-engine/alf/engine/compact/uniq.rb +23 -0
- data/lib/alf-engine/alf/engine/compact.rb +26 -0
- data/lib/alf-engine/alf/engine/concat.rb +25 -0
- data/lib/alf-engine/alf/engine/defaults.rb +43 -0
- data/lib/alf-engine/alf/engine/filter.rb +41 -0
- data/lib/alf-engine/alf/engine/generator.rb +50 -0
- data/lib/alf-engine/alf/engine/group/hash.rb +40 -0
- data/lib/alf-engine/alf/engine/group.rb +7 -0
- data/lib/alf-engine/alf/engine/join/hash.rb +35 -0
- data/lib/alf-engine/alf/engine/join.rb +7 -0
- data/lib/alf-engine/alf/engine/materialize/array.rb +78 -0
- data/lib/alf-engine/alf/engine/materialize/hash.rb +122 -0
- data/lib/alf-engine/alf/engine/materialize.rb +8 -0
- data/lib/alf-engine/alf/engine/quota/cesure.rb +46 -0
- data/lib/alf-engine/alf/engine/quota.rb +7 -0
- data/lib/alf-engine/alf/engine/rank/cesure.rb +48 -0
- data/lib/alf-engine/alf/engine/rank.rb +7 -0
- data/lib/alf-engine/alf/engine/rename.rb +39 -0
- data/lib/alf-engine/alf/engine/semi/hash.rb +39 -0
- data/lib/alf-engine/alf/engine/semi.rb +7 -0
- data/lib/alf-engine/alf/engine/set_attr.rb +46 -0
- data/lib/alf-engine/alf/engine/sort/in_memory.rb +39 -0
- data/lib/alf-engine/alf/engine/sort.rb +28 -0
- data/lib/alf-engine/alf/engine/summarize/cesure.rb +51 -0
- data/lib/alf-engine/alf/engine/summarize/hash.rb +35 -0
- data/lib/alf-engine/alf/engine/summarize.rb +8 -0
- data/lib/alf-engine/alf/engine/ungroup.rb +29 -0
- data/lib/alf-engine/alf/engine/unwrap.rb +31 -0
- data/lib/alf-engine/alf/engine/wrap.rb +39 -0
- data/lib/alf-engine/alf/engine.rb +25 -0
- data/lib/{alf/extra/logs.rb → alf-logs/alf/logs/reader.rb} +14 -16
- data/lib/alf-logs/alf/logs.rb +1 -0
- data/lib/alf-sequel/alf/sequel/environment.rb +57 -0
- data/lib/alf-sequel/alf/sequel/iterator.rb +21 -0
- data/lib/alf-sequel/alf/sequel.rb +2 -0
- data/lib/{alf → alf-shell/alf/shell}/command/exec.rb +3 -4
- data/lib/{alf → alf-shell/alf/shell}/command/help.rb +3 -4
- data/lib/alf-shell/alf/shell/command/main/class_methods.rb +46 -0
- data/lib/{alf → alf-shell/alf/shell}/command/main.rb +9 -51
- data/lib/{alf → alf-shell/alf/shell}/command/show.rb +5 -7
- data/lib/alf-shell/alf/shell/command.rb +26 -0
- data/lib/{alf/command → alf-shell/alf/shell}/doc_manager.rb +3 -3
- data/lib/alf-shell/alf/shell/operator.rb +86 -0
- data/lib/alf-shell/alf/shell.rb +40 -0
- data/lib/{alf/extra/yaml.rb → alf-yaml/alf/yaml/renderer.rb} +5 -7
- data/lib/alf-yaml/alf/yaml.rb +1 -0
- data/lib/alf.rb +17 -358
- data/spec/{unit → integration}/lispy/test_relation.rb +0 -0
- data/spec/{unit → integration}/lispy/test_run.rb +0 -0
- data/spec/{unit → integration}/lispy/test_tuple.rb +0 -0
- data/spec/integration/{command → shell}/alf/alf.db +0 -0
- data/spec/integration/{command → shell}/alf/alf_e.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_e.stdout +0 -0
- data/spec/integration/shell/alf/alf_env.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_env.stdout +0 -0
- data/spec/integration/shell/alf/alf_env_sqlite.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_env_sqlite.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_help.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_help.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_implicit.alf +0 -0
- data/spec/integration/shell/alf/alf_implicit_exec.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_implicit_exec.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_r.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_r.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_version.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_version.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_yaml.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_yaml.stdout +0 -0
- data/spec/integration/{command → shell}/alf/rel.rash +0 -0
- data/spec/integration/{command → shell}/autonum/autonum_0.cmd +0 -0
- data/spec/integration/{command → shell}/autonum/autonum_0.stdout +0 -0
- data/spec/integration/shell/autonum/autonum_1.cmd +1 -0
- data/spec/integration/{command → shell}/autonum/autonum_1.stdout +0 -0
- data/spec/integration/shell/clip/clip_0.cmd +1 -0
- data/spec/integration/{command → shell}/clip/clip_0.stdout +0 -0
- data/spec/integration/shell/clip/clip_1.cmd +1 -0
- data/spec/integration/{command → shell}/clip/clip_1.stdout +0 -0
- data/spec/integration/{command → shell}/coerce/coerce_1.cmd +0 -0
- data/spec/integration/{command → shell}/coerce/coerce_1.stdout +0 -0
- data/spec/integration/{command → shell}/compact/compact_0.cmd +0 -0
- data/spec/integration/{command → shell}/compact/compact_0.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_0.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_0.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_1.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_1.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_2.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_2.stdout +0 -0
- data/spec/integration/{command → shell}/extend/extend_0.cmd +0 -0
- data/spec/integration/{command → shell}/extend/extend_0.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_1.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_1.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_2.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_2.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_3.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_3.stdout +0 -0
- data/spec/integration/{command → shell}/group/group_0.cmd +0 -0
- data/spec/integration/{command → shell}/group/group_0.stdout +0 -0
- data/spec/integration/{command → shell}/group/group_1.cmd +0 -0
- data/spec/integration/{command → shell}/group/group_1.stdout +0 -0
- data/spec/integration/{command → shell}/help/help_1.cmd +0 -0
- data/spec/integration/{command → shell}/help/help_1.stdout +0 -0
- data/spec/integration/{command → shell}/intersect/intersect_0.cmd +0 -0
- data/spec/integration/{command → shell}/intersect/intersect_0.stdout +0 -0
- data/spec/integration/{command → shell}/join/join_0.cmd +0 -0
- data/spec/integration/{command → shell}/join/join_0.stdout +0 -0
- data/spec/integration/{command → shell}/matching/matching_0.cmd +0 -0
- data/spec/integration/{command → shell}/matching/matching_0.stdout +0 -0
- data/spec/integration/{command → shell}/minus/minus_0.cmd +0 -0
- data/spec/integration/{command → shell}/minus/minus_0.stdout +0 -0
- data/spec/integration/{command → shell}/not-matching/not-matching_0.cmd +0 -0
- data/spec/integration/{command → shell}/not-matching/not-matching_0.stdout +0 -0
- data/spec/integration/{command → shell}/project/project_0.cmd +0 -0
- data/spec/integration/{command → shell}/project/project_0.stdout +0 -0
- data/spec/integration/{command → shell}/project/project_1.cmd +0 -0
- data/spec/integration/{command → shell}/project/project_1.stdout +0 -0
- data/spec/integration/{command → shell}/quota/quota_0.cmd +0 -0
- data/spec/integration/{command → shell}/quota/quota_0.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_1.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_1.stdout +1 -1
- data/spec/integration/{command → shell}/rank/rank_2.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_2.stdout +1 -1
- data/spec/integration/{command → shell}/rank/rank_3.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_3.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_4.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_4.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_5.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_5.stdout +0 -0
- data/spec/integration/{command → shell}/rename/rename_0.cmd +0 -0
- data/spec/integration/{command → shell}/rename/rename_0.stdout +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_0.cmd +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_0.stdout +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_1.cmd +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_1.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_1.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_1.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_2.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_2.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_conflictual.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_conflictual.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_csv.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_csv.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_ff.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_ff.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_rash.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_rash.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_rash_pretty.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_rash_pretty.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_yaml.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_yaml.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_0.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_0.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_1.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_1.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_2.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_2.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_3.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_3.stdout +0 -0
- data/spec/integration/{command → shell}/summarize/summarize_0.cmd +0 -0
- data/spec/integration/{command → shell}/summarize/summarize_0.stdout +0 -0
- data/spec/integration/{command → shell}/ungroup/ungroup_0.cmd +0 -0
- data/spec/integration/{command → shell}/ungroup/ungroup_0.stdout +0 -0
- data/spec/integration/{command → shell}/union/union_0.cmd +0 -0
- data/spec/integration/{command → shell}/union/union_0.stdout +0 -0
- data/spec/integration/{command → shell}/unwrap/unwrap_0.cmd +0 -0
- data/spec/integration/{command → shell}/unwrap/unwrap_0.stdout +0 -0
- data/spec/integration/{command → shell}/wrap/wrap_0.cmd +0 -0
- data/spec/integration/{command → shell}/wrap/wrap_0.stdout +0 -0
- data/spec/{unit → integration}/test_lispy.rb +0 -0
- data/spec/integration/{test_command.rb → test_shell.rb} +3 -3
- data/spec/regression/heading/test_heading_with_date.rb +1 -1
- data/spec/shared/a_valid_type_implementation.rb +47 -0
- data/spec/shared/an_operator_class.rb +2 -6
- data/spec/spec_helper.rb +9 -1
- data/spec/unit/alf-core/aggregator/test_avg.rb +22 -0
- data/spec/unit/alf-core/aggregator/test_collect.rb +25 -0
- data/spec/unit/alf-core/aggregator/test_concat.rb +31 -0
- data/spec/unit/alf-core/aggregator/test_count.rb +17 -0
- data/spec/unit/alf-core/aggregator/test_max.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_min.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_stddev.rb +27 -0
- data/spec/unit/alf-core/aggregator/test_sum.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_variance.rb +29 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_file.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_instance_eval.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_scoping.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_set.rb +0 -0
- data/spec/unit/{environment → alf-core/environment}/examples/suppliers.rash +0 -0
- data/spec/unit/alf-core/environment/test_folder.rb +53 -0
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_autonum.rb +18 -31
- data/spec/unit/alf-core/operator/non_relational/test_clip.rb +35 -0
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_coerce.rb +11 -17
- data/spec/unit/{operator/non_relational/compact/test_sort_based.rb → alf-core/operator/non_relational/test_compact.rb} +16 -14
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_defaults.rb +17 -32
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_generator.rb +21 -39
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_sort.rb +20 -26
- data/spec/unit/{operator → alf-core/operator}/relational/test_extend.rb +8 -14
- data/spec/unit/{operator → alf-core/operator}/relational/test_group.rb +12 -28
- data/spec/unit/alf-core/operator/relational/test_heading.rb +27 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_intersect.rb +22 -22
- data/spec/unit/{operator → alf-core/operator}/relational/test_join.rb +7 -7
- data/spec/unit/{operator → alf-core/operator}/relational/test_minus.rb +23 -23
- data/spec/unit/alf-core/operator/relational/test_project.rb +62 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_quota.rb +8 -15
- data/spec/unit/alf-core/operator/relational/test_rank.rb +48 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_rename.rb +8 -14
- data/spec/unit/alf-core/operator/relational/test_restrict.rb +45 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_summarize.rb +13 -31
- data/spec/unit/{operator → alf-core/operator}/relational/test_ungroup.rb +9 -15
- data/spec/unit/{operator → alf-core/operator}/relational/test_union.rb +11 -11
- data/spec/unit/{operator → alf-core/operator}/relational/test_unwrap.rb +10 -16
- data/spec/unit/{operator → alf-core/operator}/relational/test_wrap.rb +10 -16
- data/spec/unit/alf-core/operator/signature/test_argv2args.rb +82 -0
- data/spec/unit/alf-core/operator/signature/test_collect_on.rb +38 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_initialize.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_install.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_option_parser.rb +0 -0
- data/spec/unit/alf-core/operator/signature/test_parse_args.rb +90 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_to_lispy.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_to_shell.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/test_non_relational.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/test_relational.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/input.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/test_alf_file.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/test_initialize.rb +0 -0
- data/spec/unit/alf-core/reader/test_looks_a_path.rb +20 -0
- data/spec/unit/{reader → alf-core/reader}/test_rash.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_coerce.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_inspect.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_relops.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_to_a.rb +0 -0
- data/spec/unit/{renderer → alf-core/renderer}/test_initialize.rb +0 -0
- data/spec/unit/alf-core/test_aggregator.rb +58 -0
- data/spec/unit/{test_environment.rb → alf-core/test_environment.rb} +8 -21
- data/spec/unit/{test_operator.rb → alf-core/test_operator.rb} +0 -0
- data/spec/unit/{test_reader.rb → alf-core/test_reader.rb} +0 -0
- data/spec/unit/{test_relation.rb → alf-core/test_relation.rb} +0 -0
- data/spec/unit/{test_renderer.rb → alf-core/test_renderer.rb} +0 -0
- data/spec/unit/{text → alf-core/text}/test_cell.rb +0 -0
- data/spec/unit/{text → alf-core/text}/test_row.rb +0 -0
- data/spec/unit/{text → alf-core/text}/test_table.rb +0 -0
- data/spec/unit/alf-core/tools/test_class_name.rb +16 -0
- data/spec/unit/{tools → alf-core/tools}/test_coalesce.rb +6 -2
- data/spec/unit/alf-core/tools/test_coerce.rb +16 -0
- data/spec/unit/alf-core/tools/test_ruby_case.rb +16 -0
- data/spec/unit/{tools → alf-core/tools}/test_to_lispy.rb +14 -7
- data/spec/unit/{tools → alf-core/tools}/test_to_ruby_literal.rb +5 -5
- data/spec/unit/{tools → alf-core/tools}/test_tuple_handle.rb +14 -14
- data/spec/unit/alf-core/tools/test_tuple_heading.rb +15 -0
- data/spec/unit/{tools → alf-core/tools}/test_varargs.rb +9 -6
- data/spec/unit/alf-core/types/test_attr_list.rb +188 -0
- data/spec/unit/alf-core/types/test_attr_name.rb +78 -0
- data/spec/unit/{types/test_attr_name.rb → alf-core/types/test_boolean.rb} +18 -28
- data/spec/unit/alf-core/types/test_class_methods.rb +24 -0
- data/spec/unit/alf-core/types/test_heading.rb +146 -0
- data/spec/unit/alf-core/types/test_ordering.rb +185 -0
- data/spec/unit/alf-core/types/test_renaming.rb +72 -0
- data/spec/unit/alf-core/types/test_size.rb +74 -0
- data/spec/unit/{types → alf-core/types}/test_summarization.rb +46 -14
- data/spec/unit/{types → alf-core/types}/test_tuple_computation.rb +46 -10
- data/spec/unit/alf-core/types/test_tuple_expression.rb +122 -0
- data/spec/unit/{types → alf-core/types}/test_tuple_predicate.rb +51 -22
- data/spec/unit/{csv → alf-csv}/input.csv +0 -0
- data/spec/unit/{csv → alf-csv}/test_reader.rb +0 -0
- data/spec/unit/{csv → alf-csv}/test_renderer.rb +1 -1
- data/spec/unit/alf-engine/compact/test_set.rb +33 -0
- data/spec/unit/alf-engine/compact/test_uniq.rb +33 -0
- data/spec/unit/alf-engine/group/test_hash.rb +34 -0
- data/spec/unit/{operator/relational/join/test_hash_based.rb → alf-engine/join/test_hash.rb} +21 -29
- data/spec/unit/alf-engine/materialize/test_array.rb +28 -0
- data/spec/unit/alf-engine/materialize/test_hash.rb +76 -0
- data/spec/unit/alf-engine/quota/test_cesure.rb +34 -0
- data/spec/unit/{operator/relational/test_rank.rb → alf-engine/rank/test_cesure.rb} +21 -24
- data/spec/unit/alf-engine/semi/test_hash.rb +58 -0
- data/spec/unit/alf-engine/sort/test_in_memory.rb +32 -0
- data/spec/unit/{operator/relational/summarize/test_hash_based.rb → alf-engine/summarize/test_cesure.rb} +15 -21
- data/spec/unit/{operator/relational/summarize/test_sort_based.rb → alf-engine/summarize/test_hash.rb} +15 -21
- data/spec/unit/alf-engine/test_aggregate.rb +26 -0
- data/spec/unit/alf-engine/test_autonum.rb +24 -0
- data/spec/unit/alf-engine/test_clip.rb +34 -0
- data/spec/unit/alf-engine/test_coerce.rb +35 -0
- data/spec/unit/alf-engine/test_compact.rb +33 -0
- data/spec/unit/alf-engine/test_concat.rb +38 -0
- data/spec/unit/alf-engine/test_defaults.rb +37 -0
- data/spec/unit/alf-engine/test_filter.rb +23 -0
- data/spec/unit/alf-engine/test_generator.rb +25 -0
- data/spec/unit/alf-engine/test_rename.rb +24 -0
- data/spec/unit/alf-engine/test_set_attr.rb +38 -0
- data/spec/unit/alf-engine/test_sort.rb +32 -0
- data/spec/unit/alf-engine/test_ungroup.rb +28 -0
- data/spec/unit/alf-engine/test_unwrap.rb +20 -0
- data/spec/unit/alf-engine/test_wrap.rb +26 -0
- data/spec/unit/{logs → alf-logs}/apache_combined.log +0 -0
- data/spec/unit/{logs → alf-logs}/postgresql.log +0 -0
- data/spec/unit/{logs → alf-logs}/test_reader.rb +15 -16
- data/spec/unit/{sequel → alf-sequel}/alf.db +0 -0
- data/spec/unit/alf-sequel/test_environment.rb +69 -0
- data/spec/unit/{command → alf-shell}/doc_manager/dynamic.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/example.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/example_1.txt +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/static.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/test_call.rb +2 -3
- data/spec/unit/alf-shell/main/test_class_methods.rb +44 -0
- data/spec/unit/alf-shell/operator/test_autonum.rb +28 -0
- data/spec/unit/alf-shell/operator/test_clip.rb +29 -0
- data/spec/unit/alf-shell/operator/test_coerce.rb +21 -0
- data/spec/unit/alf-shell/operator/test_compact.rb +16 -0
- data/spec/unit/alf-shell/operator/test_defaults.rb +29 -0
- data/spec/unit/alf-shell/operator/test_extend.rb +21 -0
- data/spec/unit/alf-shell/operator/test_generator.rb +37 -0
- data/spec/unit/alf-shell/operator/test_group.rb +32 -0
- data/spec/unit/alf-shell/operator/test_heading.rb +16 -0
- data/spec/unit/alf-shell/operator/test_intersect.rb +18 -0
- data/spec/unit/alf-shell/operator/test_join.rb +18 -0
- data/spec/unit/alf-shell/operator/test_matching.rb +18 -0
- data/spec/unit/alf-shell/operator/test_minus.rb +18 -0
- data/spec/unit/alf-shell/operator/test_not_matching.rb +18 -0
- data/spec/unit/alf-shell/operator/test_project.rb +38 -0
- data/spec/unit/alf-shell/operator/test_quota.rb +23 -0
- data/spec/unit/alf-shell/operator/test_rank.rb +30 -0
- data/spec/unit/alf-shell/operator/test_rename.rb +21 -0
- data/spec/unit/alf-shell/operator/test_restrict.rb +35 -0
- data/spec/unit/alf-shell/operator/test_sort.rb +49 -0
- data/spec/unit/alf-shell/operator/test_summarize.rb +30 -0
- data/spec/unit/alf-shell/operator/test_ungroup.rb +28 -0
- data/spec/unit/alf-shell/operator/test_union.rb +18 -0
- data/spec/unit/alf-shell/operator/test_unwrap.rb +28 -0
- data/spec/unit/alf-shell/operator/test_wrap.rb +30 -0
- data/tasks/debug_mail.rake +42 -45
- data/tasks/gem.rake +13 -13
- data/tasks/gh-pages.rake +11 -6
- data/tasks/integration_test.rake +0 -8
- data/tasks/regression_test.rake +0 -8
- data/tasks/unit_test.rake +0 -8
- data/tasks/yard.rake +13 -13
- metadata +909 -1107
- data/examples/hitradio/compact.rb +0 -48
- data/examples/hitradio/compare1.rb +0 -28
- data/examples/hitradio/gz_reader.rb +0 -23
- data/examples/hitradio/hitradio-1.alf +0 -1
- data/examples/hitradio/hitradio.log +0 -25080
- data/examples/hitradio/hitradio.mar +0 -25081
- data/examples/hitradio/hitradio.mar.gz +0 -0
- data/examples/hitradio/hitradio.rash +0 -25080
- data/examples/hitradio/mar_reader.rb +0 -18
- data/examples/northwind/customers.csv +0 -92
- data/examples/northwind/northwind.db +0 -0
- data/examples/northwind/orders.csv +0 -831
- data/lib/alf/aggregator/aggregators.rb +0 -105
- data/lib/alf/aggregator/aggregators.rbc +0 -2640
- data/lib/alf/aggregator/base.rbc +0 -1055
- data/lib/alf/aggregator/class_methods.rbc +0 -830
- data/lib/alf/buffer/sorted.rb +0 -48
- data/lib/alf/buffer/sorted.rbc +0 -715
- data/lib/alf/command/class_methods.rb +0 -27
- data/lib/alf/command/class_methods.rbc +0 -453
- data/lib/alf/command/doc_manager.rbc +0 -1604
- data/lib/alf/command/exec.rbc +0 -408
- data/lib/alf/command/help.rbc +0 -764
- data/lib/alf/command/main.rbc +0 -3612
- data/lib/alf/command/show.rbc +0 -1327
- data/lib/alf/environment/base.rbc +0 -459
- data/lib/alf/environment/class_methods.rbc +0 -1110
- data/lib/alf/environment/explicit.rb +0 -38
- data/lib/alf/environment/explicit.rbc +0 -601
- data/lib/alf/environment/folder.rbc +0 -942
- data/lib/alf/errors.rbc +0 -155
- data/lib/alf/extra/csv.rb +0 -107
- data/lib/alf/extra/csv.rbc +0 -2021
- data/lib/alf/extra/logs.rbc +0 -1957
- data/lib/alf/extra/sequel.rb +0 -77
- data/lib/alf/extra/sequel.rbc +0 -1417
- data/lib/alf/extra/yaml.rbc +0 -435
- data/lib/alf/extra.rb +0 -5
- data/lib/alf/extra.rbc +0 -101
- data/lib/alf/iterator/base.rb +0 -38
- data/lib/alf/iterator/base.rbc +0 -437
- data/lib/alf/iterator/class_methods.rbc +0 -518
- data/lib/alf/iterator/proxy.rbc +0 -599
- data/lib/alf/lispy/instance_methods.rbc +0 -2535
- data/lib/alf/loader.rbc +0 -85
- data/lib/alf/operator/base.rb +0 -74
- data/lib/alf/operator/base.rbc +0 -860
- data/lib/alf/operator/binary.rbc +0 -595
- data/lib/alf/operator/cesure.rbc +0 -883
- data/lib/alf/operator/class_methods.rbc +0 -1915
- data/lib/alf/operator/experimental.rbc +0 -200
- data/lib/alf/operator/non_relational/autonum.rbc +0 -587
- data/lib/alf/operator/non_relational/clip.rbc +0 -522
- data/lib/alf/operator/non_relational/coerce.rbc +0 -596
- data/lib/alf/operator/non_relational/compact.rbc +0 -1283
- data/lib/alf/operator/non_relational/defaults.rbc +0 -733
- data/lib/alf/operator/non_relational/generator.rbc +0 -1015
- data/lib/alf/operator/non_relational/sort.rbc +0 -665
- data/lib/alf/operator/nullary.rbc +0 -404
- data/lib/alf/operator/relational/extend.rbc +0 -616
- data/lib/alf/operator/relational/group.rbc +0 -968
- data/lib/alf/operator/relational/heading.rbc +0 -657
- data/lib/alf/operator/relational/intersect.rbc +0 -969
- data/lib/alf/operator/relational/join.rbc +0 -1708
- data/lib/alf/operator/relational/matching.rbc +0 -1047
- data/lib/alf/operator/relational/minus.rbc +0 -965
- data/lib/alf/operator/relational/not_matching.rbc +0 -1047
- data/lib/alf/operator/relational/project.rbc +0 -669
- data/lib/alf/operator/relational/quota.rbc +0 -1193
- data/lib/alf/operator/relational/rank.rbc +0 -1217
- data/lib/alf/operator/relational/rename.rbc +0 -496
- data/lib/alf/operator/relational/restrict.rbc +0 -611
- data/lib/alf/operator/relational/summarize.rbc +0 -1922
- data/lib/alf/operator/relational/ungroup.rbc +0 -643
- data/lib/alf/operator/relational/union.rbc +0 -846
- data/lib/alf/operator/relational/unwrap.rbc +0 -540
- data/lib/alf/operator/relational/wrap.rbc +0 -560
- data/lib/alf/operator/shortcut.rb +0 -53
- data/lib/alf/operator/shortcut.rbc +0 -809
- data/lib/alf/operator/signature.rbc +0 -4640
- data/lib/alf/operator/transform.rb +0 -27
- data/lib/alf/operator/transform.rbc +0 -484
- data/lib/alf/operator/unary.rbc +0 -629
- data/lib/alf/reader/alf_file.rbc +0 -464
- data/lib/alf/reader/base.rbc +0 -1613
- data/lib/alf/reader/class_methods.rbc +0 -1099
- data/lib/alf/reader/rash.rbc +0 -583
- data/lib/alf/relation/class_methods.rbc +0 -674
- data/lib/alf/relation/instance_methods.rbc +0 -2107
- data/lib/alf/renderer/base.rbc +0 -936
- data/lib/alf/renderer/class_methods.rbc +0 -875
- data/lib/alf/renderer/rash.rbc +0 -802
- data/lib/alf/renderer/text.rbc +0 -5530
- data/lib/alf/tools/coerce.rbc +0 -352
- data/lib/alf/tools/miscellaneous.rbc +0 -1497
- data/lib/alf/tools/to_lispy.rbc +0 -2618
- data/lib/alf/tools/to_ruby_literal.rbc +0 -344
- data/lib/alf/tools/tuple_handle.rbc +0 -738
- data/lib/alf/types/attr_list.rbc +0 -1535
- data/lib/alf/types/attr_name.rbc +0 -781
- data/lib/alf/types/boolean.rbc +0 -365
- data/lib/alf/types/heading.rbc +0 -1778
- data/lib/alf/types/ordering.rbc +0 -2228
- data/lib/alf/types/renaming.rbc +0 -1064
- data/lib/alf/types/summarization.rbc +0 -1394
- data/lib/alf/types/tuple_computation.rbc +0 -1061
- data/lib/alf/types/tuple_expression.rbc +0 -1016
- data/lib/alf/types/tuple_predicate.rbc +0 -1349
- data/lib/alf/version.rbc +0 -350
- data/lib/alf.rbc +0 -3884
- data/spec/integration/command/alf/alf_env.cmd +0 -1
- data/spec/integration/command/alf/alf_env_sqlite.cmd +0 -1
- data/spec/integration/command/alf/alf_implicit_exec.cmd +0 -1
- data/spec/integration/command/autonum/autonum_1.cmd +0 -1
- data/spec/integration/command/clip/clip_0.cmd +0 -1
- data/spec/integration/command/clip/clip_1.cmd +0 -1
- data/spec/integration/command/show/show_rash_2.cmd +0 -1
- data/spec/integration/command/show/show_rash_2.stdout +0 -5
- data/spec/integration/test_alf.rbc +0 -1098
- data/spec/integration/test_command.rbc +0 -1832
- data/spec/integration/test_examples.rbc +0 -559
- data/spec/integration/test_semantics.rbc +0 -991
- data/spec/regression/alf_file/test___FILE__.rbc +0 -524
- data/spec/regression/heading/test_heading_with_date.rbc +0 -381
- data/spec/regression/lispy/test_compile.rbc +0 -404
- data/spec/regression/logs/test_path_attribute.rbc +0 -687
- data/spec/regression/relation/test_relation_allbut_all.rbc +0 -468
- data/spec/regression/relation/test_relation_with_date.rbc +0 -381
- data/spec/regression/restrict/test_restrict_with_keywords.rbc +0 -628
- data/spec/shared/a_value.rbc +0 -337
- data/spec/shared/an_operator_class.rbc +0 -908
- data/spec/spec_helper.rbc +0 -453
- data/spec/unit/assumptions/test_file.rbc +0 -668
- data/spec/unit/assumptions/test_instance_eval.rbc +0 -654
- data/spec/unit/assumptions/test_scoping.rbc +0 -755
- data/spec/unit/assumptions/test_set.rbc +0 -1928
- data/spec/unit/command/doc_manager/test_call.rbc +0 -1537
- data/spec/unit/csv/test_reader.rbc +0 -2228
- data/spec/unit/csv/test_renderer.rbc +0 -2426
- data/spec/unit/environment/test_explicit.rb +0 -15
- data/spec/unit/environment/test_explicit.rbc +0 -464
- data/spec/unit/environment/test_folder.rb +0 -35
- data/spec/unit/environment/test_folder.rbc +0 -1304
- data/spec/unit/lispy/test_relation.rbc +0 -1477
- data/spec/unit/lispy/test_run.rbc +0 -1735
- data/spec/unit/lispy/test_tuple.rbc +0 -1686
- data/spec/unit/logs/test_reader.rbc +0 -1807
- data/spec/unit/operator/non_relational/compact/test_buffer_based.rb +0 -30
- data/spec/unit/operator/non_relational/compact/test_buffer_based.rbc +0 -1127
- data/spec/unit/operator/non_relational/compact/test_sort_based.rbc +0 -1127
- data/spec/unit/operator/non_relational/test_autonum.rbc +0 -1969
- data/spec/unit/operator/non_relational/test_clip.rb +0 -49
- data/spec/unit/operator/non_relational/test_clip.rbc +0 -1850
- data/spec/unit/operator/non_relational/test_coerce.rbc +0 -1290
- data/spec/unit/operator/non_relational/test_compact.rb +0 -38
- data/spec/unit/operator/non_relational/test_compact.rbc +0 -1382
- data/spec/unit/operator/non_relational/test_defaults.rbc +0 -2319
- data/spec/unit/operator/non_relational/test_generator.rbc +0 -2361
- data/spec/unit/operator/non_relational/test_sort.rbc +0 -2583
- data/spec/unit/operator/relational/join/test_hash_based.rbc +0 -2481
- data/spec/unit/operator/relational/matching/test_hash_based.rb +0 -60
- data/spec/unit/operator/relational/matching/test_hash_based.rbc +0 -2458
- data/spec/unit/operator/relational/not_matching/test_hash_based.rb +0 -37
- data/spec/unit/operator/relational/not_matching/test_hash_based.rbc +0 -1632
- data/spec/unit/operator/relational/summarize/test_hash_based.rbc +0 -1990
- data/spec/unit/operator/relational/summarize/test_sort_based.rbc +0 -1990
- data/spec/unit/operator/relational/test_extend.rbc +0 -1300
- data/spec/unit/operator/relational/test_group.rbc +0 -2142
- data/spec/unit/operator/relational/test_intersect.rbc +0 -2069
- data/spec/unit/operator/relational/test_join.rbc +0 -1282
- data/spec/unit/operator/relational/test_minus.rbc +0 -1995
- data/spec/unit/operator/relational/test_project.rb +0 -75
- data/spec/unit/operator/relational/test_project.rbc +0 -2870
- data/spec/unit/operator/relational/test_quota.rbc +0 -1788
- data/spec/unit/operator/relational/test_rank.rbc +0 -2079
- data/spec/unit/operator/relational/test_rename.rbc +0 -1158
- data/spec/unit/operator/relational/test_restrict.rb +0 -56
- data/spec/unit/operator/relational/test_restrict.rbc +0 -2305
- data/spec/unit/operator/relational/test_summarize.rbc +0 -2570
- data/spec/unit/operator/relational/test_ungroup.rbc +0 -1425
- data/spec/unit/operator/relational/test_union.rbc +0 -1089
- data/spec/unit/operator/relational/test_unwrap.rbc +0 -1176
- data/spec/unit/operator/relational/test_wrap.rbc +0 -1203
- data/spec/unit/operator/signature/test_collect_on.rb +0 -45
- data/spec/unit/operator/signature/test_collect_on.rbc +0 -1989
- data/spec/unit/operator/signature/test_initialize.rbc +0 -544
- data/spec/unit/operator/signature/test_install.rbc +0 -1671
- data/spec/unit/operator/signature/test_option_parser.rbc +0 -1348
- data/spec/unit/operator/signature/test_parse_args.rb +0 -60
- data/spec/unit/operator/signature/test_parse_args.rbc +0 -1908
- data/spec/unit/operator/signature/test_parse_argv.rb +0 -87
- data/spec/unit/operator/signature/test_parse_argv.rbc +0 -2878
- data/spec/unit/operator/signature/test_to_lispy.rbc +0 -3305
- data/spec/unit/operator/signature/test_to_shell.rbc +0 -3327
- data/spec/unit/operator/test_non_relational.rbc +0 -571
- data/spec/unit/operator/test_relational.rbc +0 -758
- data/spec/unit/reader/test_alf_file.rbc +0 -1107
- data/spec/unit/reader/test_initialize.rbc +0 -1774
- data/spec/unit/reader/test_rash.rbc +0 -1127
- data/spec/unit/relation/test_coerce.rbc +0 -2320
- data/spec/unit/relation/test_inspect.rbc +0 -502
- data/spec/unit/relation/test_relops.rbc +0 -1585
- data/spec/unit/relation/test_to_a.rbc +0 -1112
- data/spec/unit/renderer/test_initialize.rbc +0 -1766
- data/spec/unit/sequel/test_environment.rb +0 -54
- data/spec/unit/sequel/test_environment.rbc +0 -1723
- data/spec/unit/test_aggregator.rb +0 -109
- data/spec/unit/test_aggregator.rbc +0 -4358
- data/spec/unit/test_environment.rbc +0 -1271
- data/spec/unit/test_lispy.rbc +0 -879
- data/spec/unit/test_operator.rbc +0 -531
- data/spec/unit/test_reader.rbc +0 -1249
- data/spec/unit/test_relation.rbc +0 -2588
- data/spec/unit/test_renderer.rbc +0 -2011
- data/spec/unit/text/test_cell.rbc +0 -1532
- data/spec/unit/text/test_row.rbc +0 -847
- data/spec/unit/text/test_table.rbc +0 -978
- data/spec/unit/tools/test_coalesce.rbc +0 -456
- data/spec/unit/tools/test_coerce.rb +0 -10
- data/spec/unit/tools/test_coerce.rbc +0 -279
- data/spec/unit/tools/test_to_lispy.rbc +0 -5711
- data/spec/unit/tools/test_to_ruby_literal.rbc +0 -272
- data/spec/unit/tools/test_tools.rb +0 -25
- data/spec/unit/tools/test_tools.rbc +0 -672
- data/spec/unit/tools/test_tuple_handle.rbc +0 -1591
- data/spec/unit/tools/test_tuple_heading.rb +0 -20
- data/spec/unit/tools/test_tuple_heading.rbc +0 -821
- data/spec/unit/tools/test_varargs.rbc +0 -495
- data/spec/unit/types/heading/test_union.rb +0 -21
- data/spec/unit/types/heading/test_union.rbc +0 -1043
- data/spec/unit/types/test_attr_list.rb +0 -106
- data/spec/unit/types/test_attr_list.rbc +0 -4481
- data/spec/unit/types/test_attr_name.rbc +0 -1872
- data/spec/unit/types/test_heading.rb +0 -48
- data/spec/unit/types/test_heading.rbc +0 -1735
- data/spec/unit/types/test_ordering.rb +0 -127
- data/spec/unit/types/test_ordering.rbc +0 -3695
- data/spec/unit/types/test_renaming.rb +0 -55
- data/spec/unit/types/test_renaming.rbc +0 -2426
- data/spec/unit/types/test_summarization.rbc +0 -2538
- data/spec/unit/types/test_tuple_computation.rbc +0 -2340
- data/spec/unit/types/test_tuple_expression.rb +0 -64
- data/spec/unit/types/test_tuple_expression.rbc +0 -2285
- data/spec/unit/types/test_tuple_predicate.rbc +0 -3168
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf
|
3
|
+
describe Renaming do
|
4
|
+
|
5
|
+
describe "the class itself" do
|
6
|
+
let(:type){ Renaming }
|
7
|
+
def Renaming.exemplars
|
8
|
+
[
|
9
|
+
{},
|
10
|
+
{:old1 => :new1},
|
11
|
+
{:old1 => :new1, :old2 => :new2}
|
12
|
+
].map{|x| Renaming.coerce(x)}
|
13
|
+
end
|
14
|
+
it_should_behave_like 'A valid type implementation'
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "coerce" do
|
18
|
+
|
19
|
+
subject{ Renaming.coerce(arg) }
|
20
|
+
let(:expected){ Renaming.new(:old1 => :new1, :old2 => :new2) }
|
21
|
+
|
22
|
+
describe "from a Renaming" do
|
23
|
+
let(:arg){ Renaming.new(:old1 => :new1, :old2 => :new2) }
|
24
|
+
it{ should eq(expected) }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "from a Hash" do
|
28
|
+
let(:arg){ {"old1" => "new1", "old2" => "new2"} }
|
29
|
+
it{ should eq(expected) }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "from an Array" do
|
33
|
+
let(:arg){ ["old1", "new1", "old2", "new2"] }
|
34
|
+
it{ should eq(expected) }
|
35
|
+
end
|
36
|
+
|
37
|
+
end # coerce
|
38
|
+
|
39
|
+
describe "from_argv" do
|
40
|
+
|
41
|
+
subject{ Renaming.from_argv(argv) }
|
42
|
+
|
43
|
+
describe "from an empty Array" do
|
44
|
+
let(:argv){ [] }
|
45
|
+
it{ should eq(Renaming.new({})) }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "from an Array of two elements" do
|
49
|
+
let(:argv){ ["old", "new"] }
|
50
|
+
it{ should eq(Renaming.new(:old => :new)) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "from an Array of four elements" do
|
54
|
+
let(:argv){ ["old", "new", "hello", "world"] }
|
55
|
+
it{ should eq(Renaming.new(:old => :new, :hello => :world)) }
|
56
|
+
end
|
57
|
+
|
58
|
+
end # from_argv
|
59
|
+
|
60
|
+
describe "rename_tuple" do
|
61
|
+
let(:r){ Renaming.coerce(["old", "new"]) }
|
62
|
+
|
63
|
+
it 'should rename correctly' do
|
64
|
+
tuple = {:old => :a, :other => :b}
|
65
|
+
expected = {:new => :a, :other => :b}
|
66
|
+
r.rename_tuple(tuple).should eq(expected)
|
67
|
+
end
|
68
|
+
|
69
|
+
end # rename_tuple
|
70
|
+
|
71
|
+
end # Renaming
|
72
|
+
end # Alf
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf
|
3
|
+
module Types
|
4
|
+
describe Size do
|
5
|
+
|
6
|
+
describe "===" do
|
7
|
+
|
8
|
+
it 'should recognize 0' do
|
9
|
+
(Size === 0).should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should recognize any positive integer' do
|
13
|
+
(Size === 10).should be_true
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should not recognize negative integers' do
|
17
|
+
(Size === -1).should be_false
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should not recognize non integers' do
|
21
|
+
(Size === 10.0).should be_false
|
22
|
+
(Size === "12").should be_false
|
23
|
+
end
|
24
|
+
|
25
|
+
end # ===
|
26
|
+
|
27
|
+
describe "coerce" do
|
28
|
+
|
29
|
+
it 'should coerce strings correctly' do
|
30
|
+
Size.coerce("0").should eq(0)
|
31
|
+
Size.coerce("10").should eq(10)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should raise ArgumentError on negative integers' do
|
35
|
+
lambda{ Size.coerce("-1") }.should raise_error(ArgumentError)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should raise ArgumentError on non integers' do
|
39
|
+
lambda{ Size.coerce("hello") }.should raise_error(ArgumentError)
|
40
|
+
end
|
41
|
+
|
42
|
+
end # coerce
|
43
|
+
|
44
|
+
describe "from_argv" do
|
45
|
+
|
46
|
+
it 'should allow an empty array' do
|
47
|
+
Size.from_argv([]).should eq(0)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should use the default value on empty array' do
|
51
|
+
Size.from_argv([], :default => 10).should eq(10)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'correctly coerce when non empty' do
|
55
|
+
Size.from_argv(["12"]).should eq(12)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'raise an ArgumentError on big array' do
|
59
|
+
lambda{
|
60
|
+
Size.from_argv(["12", "hello"])
|
61
|
+
}.should raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'raise an ArgumentError on non coercable' do
|
65
|
+
lambda{
|
66
|
+
Size.from_argv(["hello"])
|
67
|
+
}.should raise_error(ArgumentError)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -1,16 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
module Alf
|
3
3
|
describe Summarization do
|
4
|
-
|
4
|
+
|
5
|
+
describe "the class itself" do
|
6
|
+
let(:type){ Summarization }
|
7
|
+
def Summarization.exemplars
|
8
|
+
[
|
9
|
+
["total", "sum{ qty }"]
|
10
|
+
].map{|x| Summarization.coerce(x)}
|
11
|
+
end
|
12
|
+
it_should_behave_like 'A valid type implementation'
|
13
|
+
end
|
14
|
+
|
5
15
|
describe "coerce" do
|
6
|
-
|
16
|
+
|
7
17
|
subject{ Summarization.coerce(arg) }
|
8
|
-
|
18
|
+
|
9
19
|
describe "from a Summarization" do
|
10
20
|
let(:arg){ Summarization.new(:s => Aggregator.sum{ qty }) }
|
11
21
|
it{ should eq(arg) }
|
12
22
|
end
|
13
|
-
|
23
|
+
|
14
24
|
describe "from a Hash" do
|
15
25
|
let(:arg){ { :s => "sum{ qty }", :m => Aggregator.max{ size } } }
|
16
26
|
it{ should be_a(Summarization) }
|
@@ -20,7 +30,7 @@ module Alf
|
|
20
30
|
}.should be_true
|
21
31
|
}
|
22
32
|
end
|
23
|
-
|
33
|
+
|
24
34
|
describe "from an Array" do
|
25
35
|
let(:arg){ ["s", "sum{ qty }", "m", "max{ size }"] }
|
26
36
|
it{ should be_a(Summarization) }
|
@@ -31,13 +41,13 @@ module Alf
|
|
31
41
|
}.should be_true
|
32
42
|
}
|
33
43
|
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
44
|
+
|
45
|
+
end # coerce
|
46
|
+
|
37
47
|
describe "from_argv" do
|
38
|
-
|
48
|
+
|
39
49
|
subject{ Summarization.from_argv(argv) }
|
40
|
-
|
50
|
+
|
41
51
|
describe "from an Array" do
|
42
52
|
let(:argv){ ["s", "sum{ qty }", "m", "max{ size }"] }
|
43
53
|
it{ should be_a(Summarization) }
|
@@ -48,9 +58,31 @@ module Alf
|
|
48
58
|
}.should be_true
|
49
59
|
}
|
50
60
|
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
61
|
+
|
62
|
+
end # from argv
|
63
|
+
|
64
|
+
describe "least" do
|
65
|
+
|
66
|
+
it 'should invoke least on each aggregator' do
|
67
|
+
sum = Summarization.coerce(["s", "avg{ qty }", "m", "max{ size }"])
|
68
|
+
sum.least.should eq({:s => [0.0, 0.0], :m => nil})
|
69
|
+
end
|
70
|
+
|
71
|
+
end # least
|
72
|
+
|
73
|
+
describe "summarize" do
|
74
|
+
|
75
|
+
it 'should summarize as expected' do
|
76
|
+
rel = [
|
77
|
+
{:qty => 10, :size => 12},
|
78
|
+
{:qty => 5, :size => 5}
|
79
|
+
]
|
80
|
+
sum = Summarization.coerce(["s", "avg{ qty }", "m", "max{ size }"])
|
81
|
+
sum.summarize(rel).should eq({:s => 7.5, :m => 12})
|
82
|
+
end
|
83
|
+
|
84
|
+
end # describe
|
85
|
+
|
54
86
|
specify "least -> happens -> finalize" do
|
55
87
|
summ = Summarization.coerce(["s", "sum{ qty }", "m", "max{ size }"])
|
56
88
|
(x = summ.least).should eql(:s => 0, :m => nil)
|
@@ -58,6 +90,6 @@ module Alf
|
|
58
90
|
(x = summ.happens(x, :qty => 5, :size => 5)).should eq(:s => 15, :m => 12)
|
59
91
|
summ.finalize(x).should eq(:s => 15, :m => 12)
|
60
92
|
end
|
61
|
-
|
93
|
+
|
62
94
|
end
|
63
95
|
end
|
@@ -2,11 +2,32 @@ require 'spec_helper'
|
|
2
2
|
module Alf
|
3
3
|
describe TupleComputation do
|
4
4
|
|
5
|
+
describe "the class itself" do
|
6
|
+
let(:type){ TupleComputation }
|
7
|
+
def TupleComputation.exemplars
|
8
|
+
[
|
9
|
+
{:status => 10},
|
10
|
+
{:big? => "status > 10"}
|
11
|
+
].map{|x| TupleComputation.coerce(x)}
|
12
|
+
end
|
13
|
+
it_should_behave_like 'A valid type implementation'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have a valid example' do
|
17
|
+
computation = TupleComputation[
|
18
|
+
:big? => lambda{ status > 20 },
|
19
|
+
:who => lambda{ "#{first} #{last}" }
|
20
|
+
]
|
21
|
+
res = computation.call(:last => "Jones", :first => "Bill", :status => 10)
|
22
|
+
res.should eq(:big? => false, :who => "Bill Jones")
|
23
|
+
end
|
24
|
+
|
5
25
|
let(:handle){ Tools::TupleHandle.new.set(:who => "alf") }
|
6
|
-
|
26
|
+
|
7
27
|
describe "coerce" do
|
28
|
+
|
8
29
|
subject{ TupleComputation.coerce(arg).evaluate(handle) }
|
9
|
-
|
30
|
+
|
10
31
|
describe "from a TupleComputation" do
|
11
32
|
let(:arg){ TupleComputation.new :hello => TupleExpression.coerce(:who) }
|
12
33
|
it{ should eql(:hello => "alf") }
|
@@ -23,7 +44,7 @@ module Alf
|
|
23
44
|
}
|
24
45
|
it{ should eql(expected) }
|
25
46
|
end
|
26
|
-
|
47
|
+
|
27
48
|
describe "from a Hash with coercion" do
|
28
49
|
let(:arg){
|
29
50
|
{"hello" => "who", "hello2" => "2"}
|
@@ -33,7 +54,7 @@ module Alf
|
|
33
54
|
}
|
34
55
|
it{ should eql(expected) }
|
35
56
|
end
|
36
|
-
|
57
|
+
|
37
58
|
describe "from an Array with coercions" do
|
38
59
|
let(:arg){ ["hello", "who", "hello2", "2"] }
|
39
60
|
let(:expected){
|
@@ -41,9 +62,11 @@ module Alf
|
|
41
62
|
}
|
42
63
|
it{ should eql(expected) }
|
43
64
|
end
|
44
|
-
|
45
|
-
|
65
|
+
|
66
|
+
end # coerce
|
67
|
+
|
46
68
|
describe "from_argv" do
|
69
|
+
|
47
70
|
subject{ TupleComputation.from_argv(argv).evaluate(handle) }
|
48
71
|
|
49
72
|
describe "from an Array with coercions" do
|
@@ -53,8 +76,21 @@ module Alf
|
|
53
76
|
}
|
54
77
|
it{ should eql(expected) }
|
55
78
|
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
79
|
+
|
80
|
+
end # from_argv
|
81
|
+
|
82
|
+
describe "to_attr_list" do
|
83
|
+
|
84
|
+
it 'should return the correct list of attribute names' do
|
85
|
+
list = TupleComputation[
|
86
|
+
:big? => lambda{ status > 20 },
|
87
|
+
:who => lambda{ "#{first} #{last}" }
|
88
|
+
].to_attr_list
|
89
|
+
list.should be_a(AttrList)
|
90
|
+
list.to_a.to_set.should eq([:big?, :who].to_set)
|
91
|
+
end
|
92
|
+
|
93
|
+
end # "to_attr_list"
|
94
|
+
|
59
95
|
end
|
60
|
-
end
|
96
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf
|
3
|
+
describe TupleExpression do
|
4
|
+
|
5
|
+
describe "the class itself" do
|
6
|
+
let(:type){ TupleExpression }
|
7
|
+
def TupleExpression.exemplars
|
8
|
+
[
|
9
|
+
"10",
|
10
|
+
"status > 10",
|
11
|
+
].map{|x| TupleExpression.coerce(x)}
|
12
|
+
end
|
13
|
+
it_should_behave_like 'A valid type implementation'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should include a valid example" do
|
17
|
+
expr = TupleExpression["status * 10"]
|
18
|
+
expr.call(:status => 20).should eq(200)
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:handle) {
|
22
|
+
Tools::TupleHandle.new.set(:status => 10)
|
23
|
+
}
|
24
|
+
|
25
|
+
describe "coerce" do
|
26
|
+
|
27
|
+
subject{ TupleExpression.coerce(arg) }
|
28
|
+
|
29
|
+
describe "with nil" do
|
30
|
+
let(:arg){ nil }
|
31
|
+
specify{ lambda{ subject }.should raise_error(ArgumentError) }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "with a String" do
|
35
|
+
let(:arg){ "true" }
|
36
|
+
it { should be_a(TupleExpression) }
|
37
|
+
specify{
|
38
|
+
subject.evaluate(handle).should eql(true)
|
39
|
+
subject.source.should eq("true")
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "with a Symbol" do
|
44
|
+
let(:arg){ :status }
|
45
|
+
it { should be_a(TupleExpression) }
|
46
|
+
specify{
|
47
|
+
subject.evaluate(handle).should eql(10)
|
48
|
+
subject.source.should eq(:status)
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "with a Proc" do
|
53
|
+
let(:arg){ lambda{ :hello } }
|
54
|
+
it { should be_a(TupleExpression) }
|
55
|
+
specify{
|
56
|
+
subject.evaluate(handle).should eql(:hello)
|
57
|
+
subject.source.should be_nil
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
end # coerce
|
62
|
+
|
63
|
+
describe "from_argv" do
|
64
|
+
|
65
|
+
subject{ TupleExpression.from_argv(argv) }
|
66
|
+
|
67
|
+
describe "with a String (1)" do
|
68
|
+
let(:argv){ %w{true} }
|
69
|
+
it { should be_a(TupleExpression) }
|
70
|
+
specify{
|
71
|
+
subject.evaluate(handle).should eql(true)
|
72
|
+
subject.source.should eq("true")
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "with a String (2)" do
|
77
|
+
let(:argv){ ["status > 10"] }
|
78
|
+
it { should be_a(TupleExpression) }
|
79
|
+
specify{
|
80
|
+
subject.evaluate(handle).should eql(false)
|
81
|
+
subject.source.should eq("status > 10")
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "with two String" do
|
86
|
+
let(:argv){ %w{hello world} }
|
87
|
+
specify{ lambda{subject}.should raise_error(ArgumentError) }
|
88
|
+
end
|
89
|
+
|
90
|
+
end # from_argv
|
91
|
+
|
92
|
+
describe 'call' do
|
93
|
+
let(:expr){ TupleExpression["status > 10"] }
|
94
|
+
|
95
|
+
it 'should build its handle correctly' do
|
96
|
+
expr.call(:status => 20).should be_true
|
97
|
+
expr.call(:status => 5).should be_false
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should be aliased ad []' do
|
101
|
+
expr[:status => 20].should be_true
|
102
|
+
expr[:status => 5].should be_false
|
103
|
+
end
|
104
|
+
|
105
|
+
end # call
|
106
|
+
|
107
|
+
describe 'to_ruby_literal' do
|
108
|
+
|
109
|
+
it 'should work when code is known' do
|
110
|
+
expr = TupleExpression["status > 10"]
|
111
|
+
expr.to_ruby_literal.should eq('Alf::TupleExpression["status > 10"]')
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should raise a NotImplementedError if no source code' do
|
115
|
+
expr = TupleExpression[lambda{status > 10}]
|
116
|
+
lambda{ expr.to_ruby_literal }.should raise_error(NotImplementedError)
|
117
|
+
end
|
118
|
+
|
119
|
+
end # to_ruby_literal
|
120
|
+
|
121
|
+
end # TupleExpression
|
122
|
+
end # Alf
|
@@ -2,78 +2,107 @@ require 'spec_helper'
|
|
2
2
|
module Alf
|
3
3
|
describe TuplePredicate do
|
4
4
|
|
5
|
+
describe "the class itself" do
|
6
|
+
let(:type){ TuplePredicate }
|
7
|
+
def TuplePredicate.exemplars
|
8
|
+
[
|
9
|
+
"status > 10",
|
10
|
+
{:status => 10}
|
11
|
+
].map{|x| TuplePredicate.coerce(x)}
|
12
|
+
end
|
13
|
+
it_should_behave_like 'A valid type implementation'
|
14
|
+
end
|
15
|
+
|
5
16
|
let(:handle){ Tools::TupleHandle.new.set(:status => 10) }
|
6
|
-
|
17
|
+
|
7
18
|
describe "coerce" do
|
8
|
-
|
9
|
-
|
19
|
+
|
20
|
+
let(:pred){ TuplePredicate.coerce(arg) }
|
21
|
+
before{ pred.should be_a(TuplePredicate) }
|
22
|
+
subject{ pred.evaluate(handle) }
|
23
|
+
|
10
24
|
describe "from TuplePredicate" do
|
11
25
|
let(:arg){ TuplePredicate.new(lambda{ status == 10 }) }
|
12
26
|
it{ should eql(true) }
|
13
27
|
end
|
14
|
-
|
28
|
+
|
15
29
|
describe "from true" do
|
16
30
|
let(:arg){ true }
|
17
31
|
it{ should eql(true) }
|
18
32
|
end
|
19
|
-
|
33
|
+
|
20
34
|
describe "from false" do
|
21
35
|
let(:arg){ false }
|
22
36
|
it{ should eql(false) }
|
23
37
|
end
|
24
|
-
|
38
|
+
|
25
39
|
describe "from Proc" do
|
26
40
|
let(:arg){ lambda{ status == 10 } }
|
27
41
|
it{ should eql(true) }
|
28
42
|
end
|
29
|
-
|
43
|
+
|
30
44
|
describe "from String" do
|
31
45
|
let(:arg){ "status == 10" }
|
32
46
|
it{ should eql(true) }
|
33
47
|
end
|
34
|
-
|
48
|
+
|
35
49
|
describe "from Symbol" do
|
36
50
|
let(:arg){ :status }
|
37
51
|
it{ should eql(10) }
|
38
52
|
end
|
39
|
-
|
53
|
+
|
40
54
|
describe "from Hash without coercion" do
|
41
55
|
let(:arg){ {:status => 10} }
|
42
56
|
it{ should eql(true) }
|
43
57
|
end
|
44
|
-
|
58
|
+
|
45
59
|
describe "from Hash with coercion" do
|
46
60
|
let(:arg){ {"status" => "10"} }
|
47
61
|
it{ should eql(true) }
|
48
62
|
end
|
49
|
-
|
63
|
+
|
50
64
|
describe "from a singleton Array" do
|
51
65
|
let(:arg){ ["status == 10"] }
|
52
66
|
it{ should eql(true) }
|
53
67
|
end
|
54
|
-
|
68
|
+
|
55
69
|
describe "from an Array with coercion" do
|
56
70
|
let(:arg){ ["status", "10"] }
|
57
71
|
it{ should eql(true) }
|
58
72
|
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
73
|
+
|
74
|
+
end # coerce
|
75
|
+
|
62
76
|
describe "from_argv" do
|
77
|
+
|
63
78
|
subject{ TuplePredicate.from_argv(argv).evaluate(handle) }
|
64
79
|
|
65
|
-
|
66
80
|
describe "from a singleton Array" do
|
67
81
|
let(:argv){ ["status == 10"] }
|
68
82
|
it{ should eql(true) }
|
69
83
|
end
|
70
|
-
|
84
|
+
|
71
85
|
describe "from an Array with coercion" do
|
72
86
|
let(:argv){ ["status", "10"] }
|
73
87
|
it{ should eql(true) }
|
74
88
|
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
|
89
|
+
|
90
|
+
end # from_argv
|
91
|
+
|
92
|
+
describe 'to_ruby_literal' do
|
93
|
+
|
94
|
+
it 'should work when code is known' do
|
95
|
+
expr = TuplePredicate["status > 10"]
|
96
|
+
expr.should be_a(TuplePredicate)
|
97
|
+
expr.to_ruby_literal.should eq('Alf::TuplePredicate["status > 10"]')
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should raise a NotImplementedError if no source code' do
|
101
|
+
expr = TuplePredicate[lambda{status > 10}]
|
102
|
+
lambda{ expr.to_ruby_literal }.should raise_error(NotImplementedError)
|
103
|
+
end
|
104
|
+
|
105
|
+
end # to_ruby_literal
|
106
|
+
|
107
|
+
end # TuplePredicate
|
108
|
+
end # Alf
|
File without changes
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf
|
3
|
+
module Engine
|
4
|
+
describe Compact::Set do
|
5
|
+
|
6
|
+
it 'should work on an empty operand' do
|
7
|
+
Compact::Set.new([]).to_a.should eq([])
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should work when no duplicate is present' do
|
11
|
+
rel = [
|
12
|
+
{:name => "Jones"},
|
13
|
+
{:name => "Smith"}
|
14
|
+
]
|
15
|
+
Compact::Set.new(rel).to_set.should eq(rel.to_set)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should work when duplicates are present' do
|
19
|
+
rel = [
|
20
|
+
{:name => "Jones"},
|
21
|
+
{:name => "Smith"},
|
22
|
+
{:name => "Jones"},
|
23
|
+
]
|
24
|
+
exp = [
|
25
|
+
{:name => "Jones"},
|
26
|
+
{:name => "Smith"}
|
27
|
+
]
|
28
|
+
Compact::Set.new(rel).to_set.should eq(exp.to_set)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end # module Engine
|
33
|
+
end # module Alf
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Alf
|
3
|
+
module Engine
|
4
|
+
describe Compact::Uniq do
|
5
|
+
|
6
|
+
it 'should work on an empty operand' do
|
7
|
+
Compact::Uniq.new([]).to_a.should eq([])
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should work when no duplicate is present' do
|
11
|
+
rel = [
|
12
|
+
{:name => "Jones"},
|
13
|
+
{:name => "Smith"}
|
14
|
+
]
|
15
|
+
Compact::Uniq.new(rel).to_a.should eq(rel)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should work when duplicates are present' do
|
19
|
+
rel = [
|
20
|
+
{:name => "Jones"},
|
21
|
+
{:name => "Smith"},
|
22
|
+
{:name => "Jones"},
|
23
|
+
]
|
24
|
+
exp = [
|
25
|
+
{:name => "Jones"},
|
26
|
+
{:name => "Smith"}
|
27
|
+
]
|
28
|
+
Compact::Uniq.new(rel).to_a.should eq(exp)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end # module Engine
|
33
|
+
end # module Alf
|