alf 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +186 -80
- data/Gemfile +16 -32
- data/Gemfile.lock +35 -34
- data/LICENCE.md +1 -1
- data/Manifest.txt +7 -9
- data/README.md +139 -809
- data/alf.gemspec +6 -15
- data/alf.noespec +16 -34
- data/lib/alf.rb +3 -73
- data/lib/alf/loader.rb +3 -3
- data/lib/alf/version.rb +2 -2
- data/spec/spec_helper.rb +3 -18
- data/spec/test_alf.rb +8 -0
- data/tasks/test.rake +6 -0
- data/test/migrations/test_folder_migration.rb +18 -0
- data/test/migrations/test_sequel_migration.rb +34 -0
- data/test/seeding/test_seeding.rb +49 -0
- data/test/test_alf.rb +8 -0
- data/test/test_helpers.rb +24 -0
- metadata +54 -952
- data/TODO.md +0 -21
- data/bin/alf +0 -27
- data/doc/commands/exec.md +0 -16
- data/doc/commands/help.md +0 -11
- data/doc/commands/main.md +0 -33
- data/doc/commands/show.md +0 -19
- data/doc/operators/non_relational/autonum.md +0 -23
- data/doc/operators/non_relational/clip.md +0 -31
- data/doc/operators/non_relational/coerce.md +0 -15
- data/doc/operators/non_relational/compact.md +0 -20
- data/doc/operators/non_relational/defaults.md +0 -32
- data/doc/operators/non_relational/generator.md +0 -20
- data/doc/operators/non_relational/sort.md +0 -24
- data/doc/operators/relational/extend.md +0 -18
- data/doc/operators/relational/group.md +0 -27
- data/doc/operators/relational/heading.md +0 -20
- data/doc/operators/relational/intersect.md +0 -13
- data/doc/operators/relational/join.md +0 -28
- data/doc/operators/relational/matching.md +0 -24
- data/doc/operators/relational/minus.md +0 -12
- data/doc/operators/relational/not-matching.md +0 -20
- data/doc/operators/relational/project.md +0 -28
- data/doc/operators/relational/quota.md +0 -21
- data/doc/operators/relational/rank.md +0 -27
- data/doc/operators/relational/rename.md +0 -17
- data/doc/operators/relational/restrict.md +0 -25
- data/doc/operators/relational/summarize.md +0 -25
- data/doc/operators/relational/ungroup.md +0 -20
- data/doc/operators/relational/union.md +0 -14
- data/doc/operators/relational/unwrap.md +0 -20
- data/doc/operators/relational/wrap.md +0 -24
- data/examples/csv/suppliers.csv +0 -6
- data/examples/logs/access.log +0 -1000
- data/examples/logs/combined.alf +0 -2
- data/examples/logs/hits.alf +0 -14
- data/examples/logs/not_found.alf +0 -7
- data/examples/logs/robots-cheating.alf +0 -11
- data/examples/logs/robots.alf +0 -8
- data/examples/operators/autonum.alf +0 -6
- data/examples/operators/cities.rash +0 -4
- data/examples/operators/clip.alf +0 -3
- data/examples/operators/compact.alf +0 -2
- data/examples/operators/database.alf +0 -5
- data/examples/operators/defaults.alf +0 -3
- data/examples/operators/extend.alf +0 -3
- data/examples/operators/group.alf +0 -3
- data/examples/operators/intersect.alf +0 -4
- data/examples/operators/join.alf +0 -2
- data/examples/operators/matching.alf +0 -2
- data/examples/operators/minus.alf +0 -8
- data/examples/operators/not_matching.alf +0 -2
- data/examples/operators/nulls.rash +0 -3
- data/examples/operators/parts.rash +0 -6
- data/examples/operators/project.alf +0 -3
- data/examples/operators/pseudo-with.alf +0 -7
- data/examples/operators/quota.alf +0 -4
- data/examples/operators/rank.alf +0 -4
- data/examples/operators/rename.alf +0 -3
- data/examples/operators/restrict.alf +0 -2
- data/examples/operators/schema.yaml +0 -28
- data/examples/operators/sort.alf +0 -4
- data/examples/operators/summarize.alf +0 -16
- data/examples/operators/suppliers.rash +0 -5
- data/examples/operators/supplies.rash +0 -12
- data/examples/operators/ungroup.alf +0 -4
- data/examples/operators/union.alf +0 -3
- data/examples/operators/unwrap.alf +0 -4
- data/examples/operators/wrap.alf +0 -2
- data/lib/alf-csv/alf/csv.rb +0 -3
- data/lib/alf-csv/alf/csv/commons.rb +0 -36
- data/lib/alf-csv/alf/csv/reader.rb +0 -33
- data/lib/alf-csv/alf/csv/renderer.rb +0 -38
- data/lib/alf-engine/alf/engine.rb +0 -25
- data/lib/alf-engine/alf/engine/aggregate.rb +0 -44
- data/lib/alf-engine/alf/engine/autonum.rb +0 -45
- data/lib/alf-engine/alf/engine/cesure.rb +0 -45
- data/lib/alf-engine/alf/engine/clip.rb +0 -53
- data/lib/alf-engine/alf/engine/coerce.rb +0 -46
- data/lib/alf-engine/alf/engine/cog.rb +0 -7
- data/lib/alf-engine/alf/engine/compact.rb +0 -26
- data/lib/alf-engine/alf/engine/compact/set.rb +0 -23
- data/lib/alf-engine/alf/engine/compact/uniq.rb +0 -23
- data/lib/alf-engine/alf/engine/concat.rb +0 -25
- data/lib/alf-engine/alf/engine/defaults.rb +0 -43
- data/lib/alf-engine/alf/engine/filter.rb +0 -41
- data/lib/alf-engine/alf/engine/generator.rb +0 -50
- data/lib/alf-engine/alf/engine/group.rb +0 -7
- data/lib/alf-engine/alf/engine/group/hash.rb +0 -40
- data/lib/alf-engine/alf/engine/join.rb +0 -7
- data/lib/alf-engine/alf/engine/join/hash.rb +0 -35
- data/lib/alf-engine/alf/engine/materialize.rb +0 -8
- data/lib/alf-engine/alf/engine/materialize/array.rb +0 -78
- data/lib/alf-engine/alf/engine/materialize/hash.rb +0 -122
- data/lib/alf-engine/alf/engine/quota.rb +0 -7
- data/lib/alf-engine/alf/engine/quota/cesure.rb +0 -46
- data/lib/alf-engine/alf/engine/rank.rb +0 -7
- data/lib/alf-engine/alf/engine/rank/cesure.rb +0 -48
- data/lib/alf-engine/alf/engine/rename.rb +0 -39
- data/lib/alf-engine/alf/engine/semi.rb +0 -7
- data/lib/alf-engine/alf/engine/semi/hash.rb +0 -39
- data/lib/alf-engine/alf/engine/set_attr.rb +0 -46
- data/lib/alf-engine/alf/engine/sort.rb +0 -28
- data/lib/alf-engine/alf/engine/sort/in_memory.rb +0 -39
- data/lib/alf-engine/alf/engine/summarize.rb +0 -8
- data/lib/alf-engine/alf/engine/summarize/cesure.rb +0 -51
- data/lib/alf-engine/alf/engine/summarize/hash.rb +0 -35
- data/lib/alf-engine/alf/engine/ungroup.rb +0 -29
- data/lib/alf-engine/alf/engine/unwrap.rb +0 -31
- data/lib/alf-engine/alf/engine/wrap.rb +0 -39
- data/lib/alf-logs/alf/logs.rb +0 -1
- data/lib/alf-logs/alf/logs/reader.rb +0 -98
- data/lib/alf-sequel/alf/sequel.rb +0 -2
- data/lib/alf-sequel/alf/sequel/environment.rb +0 -61
- data/lib/alf-sequel/alf/sequel/iterator.rb +0 -21
- data/lib/alf-shell/alf/shell.rb +0 -40
- data/lib/alf-shell/alf/shell/command.rb +0 -26
- data/lib/alf-shell/alf/shell/command/exec.rb +0 -11
- data/lib/alf-shell/alf/shell/command/help.rb +0 -30
- data/lib/alf-shell/alf/shell/command/main.rb +0 -136
- data/lib/alf-shell/alf/shell/command/main/class_methods.rb +0 -46
- data/lib/alf-shell/alf/shell/command/show.rb +0 -63
- data/lib/alf-shell/alf/shell/doc_manager.rb +0 -72
- data/lib/alf-shell/alf/shell/operator.rb +0 -86
- data/lib/alf-yaml/alf/yaml.rb +0 -1
- data/lib/alf-yaml/alf/yaml/renderer.rb +0 -22
- data/lib/alf/aggregator.rb +0 -51
- data/lib/alf/aggregator/avg.rb +0 -39
- data/lib/alf/aggregator/class_methods.rb +0 -77
- data/lib/alf/aggregator/collect.rb +0 -32
- data/lib/alf/aggregator/concat.rb +0 -47
- data/lib/alf/aggregator/count.rb +0 -32
- data/lib/alf/aggregator/instance_methods.rb +0 -119
- data/lib/alf/aggregator/max.rb +0 -32
- data/lib/alf/aggregator/min.rb +0 -32
- data/lib/alf/aggregator/stddev.rb +0 -25
- data/lib/alf/aggregator/sum.rb +0 -32
- data/lib/alf/aggregator/variance.rb +0 -45
- data/lib/alf/environment.rb +0 -34
- data/lib/alf/environment/class_methods.rb +0 -95
- data/lib/alf/environment/folder.rb +0 -60
- data/lib/alf/environment/instance_methods.rb +0 -26
- data/lib/alf/errors.rb +0 -5
- data/lib/alf/ext.rb +0 -4
- data/lib/alf/ext/relation.rb +0 -4
- data/lib/alf/iterator.rb +0 -28
- data/lib/alf/iterator/class_methods.rb +0 -20
- data/lib/alf/iterator/proxy.rb +0 -27
- data/lib/alf/lispy.rb +0 -24
- data/lib/alf/lispy/instance_methods.rb +0 -157
- data/lib/alf/operator.rb +0 -68
- data/lib/alf/operator/binary.rb +0 -21
- data/lib/alf/operator/class_methods.rb +0 -82
- data/lib/alf/operator/experimental.rb +0 -9
- data/lib/alf/operator/instance_methods.rb +0 -29
- data/lib/alf/operator/non_relational/autonum.rb +0 -19
- data/lib/alf/operator/non_relational/clip.rb +0 -20
- data/lib/alf/operator/non_relational/coerce.rb +0 -19
- data/lib/alf/operator/non_relational/compact.rb +0 -18
- data/lib/alf/operator/non_relational/defaults.rb +0 -22
- data/lib/alf/operator/non_relational/generator.rb +0 -20
- data/lib/alf/operator/non_relational/sort.rb +0 -19
- data/lib/alf/operator/nullary.rb +0 -11
- data/lib/alf/operator/relational/extend.rb +0 -19
- data/lib/alf/operator/relational/group.rb +0 -21
- data/lib/alf/operator/relational/heading.rb +0 -20
- data/lib/alf/operator/relational/intersect.rb +0 -18
- data/lib/alf/operator/relational/join.rb +0 -18
- data/lib/alf/operator/relational/matching.rb +0 -18
- data/lib/alf/operator/relational/minus.rb +0 -18
- data/lib/alf/operator/relational/not_matching.rb +0 -18
- data/lib/alf/operator/relational/project.rb +0 -22
- data/lib/alf/operator/relational/quota.rb +0 -23
- data/lib/alf/operator/relational/rank.rb +0 -22
- data/lib/alf/operator/relational/rename.rb +0 -18
- data/lib/alf/operator/relational/restrict.rb +0 -18
- data/lib/alf/operator/relational/summarize.rb +0 -27
- data/lib/alf/operator/relational/ungroup.rb +0 -19
- data/lib/alf/operator/relational/union.rb +0 -20
- data/lib/alf/operator/relational/unwrap.rb +0 -19
- data/lib/alf/operator/relational/wrap.rb +0 -20
- data/lib/alf/operator/signature.rb +0 -233
- data/lib/alf/operator/unary.rb +0 -16
- data/lib/alf/reader.rb +0 -37
- data/lib/alf/reader/alf_file.rb +0 -24
- data/lib/alf/reader/class_methods.rb +0 -91
- data/lib/alf/reader/instance_methods.rb +0 -97
- data/lib/alf/reader/rash.rb +0 -28
- data/lib/alf/relation.rb +0 -28
- data/lib/alf/relation/class_methods.rb +0 -28
- data/lib/alf/relation/instance_methods.rb +0 -119
- data/lib/alf/renderer.rb +0 -32
- data/lib/alf/renderer/class_methods.rb +0 -58
- data/lib/alf/renderer/instance_methods.rb +0 -55
- data/lib/alf/renderer/rash.rb +0 -33
- data/lib/alf/renderer/text.rb +0 -198
- data/lib/alf/tools.rb +0 -15
- data/lib/alf/tools/coerce.rb +0 -25
- data/lib/alf/tools/miscellaneous.rb +0 -111
- data/lib/alf/tools/to_lispy.rb +0 -96
- data/lib/alf/tools/to_relation.rb +0 -54
- data/lib/alf/tools/to_ruby_literal.rb +0 -31
- data/lib/alf/tools/tuple_handle.rb +0 -60
- data/lib/alf/types.rb +0 -49
- data/lib/alf/types/attr_list.rb +0 -160
- data/lib/alf/types/attr_name.rb +0 -66
- data/lib/alf/types/boolean.rb +0 -25
- data/lib/alf/types/heading.rb +0 -135
- data/lib/alf/types/ordering.rb +0 -146
- data/lib/alf/types/renaming.rb +0 -97
- data/lib/alf/types/size.rb +0 -57
- data/lib/alf/types/summarization.rb +0 -138
- data/lib/alf/types/tuple_computation.rb +0 -136
- data/lib/alf/types/tuple_expression.rb +0 -152
- data/lib/alf/types/tuple_predicate.rb +0 -73
- data/spec/integration/__database__/group.alf +0 -3
- data/spec/integration/__database__/parts.rash +0 -6
- data/spec/integration/__database__/suppliers.rash +0 -5
- data/spec/integration/__database__/suppliers_csv.csv +0 -6
- data/spec/integration/__database__/supplies.rash +0 -12
- data/spec/integration/alf/example.rash +0 -1
- data/spec/integration/alf/test_Relation.rb +0 -32
- data/spec/integration/ext/test_relation.rb +0 -16
- data/spec/integration/lispy/test_relation.rb +0 -37
- data/spec/integration/lispy/test_run.rb +0 -40
- data/spec/integration/lispy/test_tuple.rb +0 -36
- data/spec/integration/semantics/test_join.alf +0 -9
- data/spec/integration/semantics/test_minus.alf +0 -5
- data/spec/integration/semantics/test_project.alf +0 -8
- data/spec/integration/semantics/test_rank.alf +0 -34
- data/spec/integration/shell/alf/alf.db +0 -0
- data/spec/integration/shell/alf/alf_e.cmd +0 -1
- data/spec/integration/shell/alf/alf_e.stdout +0 -4
- data/spec/integration/shell/alf/alf_env.cmd +0 -1
- data/spec/integration/shell/alf/alf_env.stdout +0 -5
- data/spec/integration/shell/alf/alf_env_sqlite.cmd +0 -1
- data/spec/integration/shell/alf/alf_env_sqlite.stdout +0 -9
- data/spec/integration/shell/alf/alf_help.cmd +0 -1
- data/spec/integration/shell/alf/alf_help.stdout +0 -69
- data/spec/integration/shell/alf/alf_implicit.alf +0 -1
- data/spec/integration/shell/alf/alf_implicit_exec.cmd +0 -1
- data/spec/integration/shell/alf/alf_implicit_exec.stdout +0 -4
- data/spec/integration/shell/alf/alf_r.cmd +0 -1
- data/spec/integration/shell/alf/alf_r.stdout +0 -5
- data/spec/integration/shell/alf/alf_version.cmd +0 -1
- data/spec/integration/shell/alf/alf_version.stdout +0 -2
- data/spec/integration/shell/alf/alf_yaml.cmd +0 -1
- data/spec/integration/shell/alf/alf_yaml.stdout +0 -22
- data/spec/integration/shell/alf/rel.rash +0 -1
- data/spec/integration/shell/autonum/autonum_0.cmd +0 -1
- data/spec/integration/shell/autonum/autonum_0.stdout +0 -9
- data/spec/integration/shell/autonum/autonum_1.cmd +0 -1
- data/spec/integration/shell/autonum/autonum_1.stdout +0 -9
- data/spec/integration/shell/clip/clip_0.cmd +0 -1
- data/spec/integration/shell/clip/clip_0.stdout +0 -9
- data/spec/integration/shell/clip/clip_1.cmd +0 -1
- data/spec/integration/shell/clip/clip_1.stdout +0 -9
- data/spec/integration/shell/coerce/coerce_1.cmd +0 -1
- data/spec/integration/shell/coerce/coerce_1.stdout +0 -5
- data/spec/integration/shell/compact/compact_0.cmd +0 -1
- data/spec/integration/shell/compact/compact_0.stdout +0 -9
- data/spec/integration/shell/defaults/defaults_0.cmd +0 -1
- data/spec/integration/shell/defaults/defaults_0.stdout +0 -9
- data/spec/integration/shell/defaults/defaults_1.cmd +0 -1
- data/spec/integration/shell/defaults/defaults_1.stdout +0 -9
- data/spec/integration/shell/defaults/defaults_2.cmd +0 -1
- data/spec/integration/shell/defaults/defaults_2.stdout +0 -9
- data/spec/integration/shell/extend/extend_0.cmd +0 -1
- data/spec/integration/shell/extend/extend_0.stdout +0 -16
- data/spec/integration/shell/generator/generator_1.cmd +0 -1
- data/spec/integration/shell/generator/generator_1.stdout +0 -10
- data/spec/integration/shell/generator/generator_2.cmd +0 -1
- data/spec/integration/shell/generator/generator_2.stdout +0 -5
- data/spec/integration/shell/generator/generator_3.cmd +0 -1
- data/spec/integration/shell/generator/generator_3.stdout +0 -5
- data/spec/integration/shell/group/group_0.cmd +0 -1
- data/spec/integration/shell/group/group_0.stdout +0 -32
- data/spec/integration/shell/group/group_1.cmd +0 -1
- data/spec/integration/shell/group/group_1.stdout +0 -32
- data/spec/integration/shell/help/help_1.cmd +0 -1
- data/spec/integration/shell/help/help_1.stdout +0 -24
- data/spec/integration/shell/intersect/intersect_0.cmd +0 -1
- data/spec/integration/shell/intersect/intersect_0.stdout +0 -9
- data/spec/integration/shell/join/join_0.cmd +0 -1
- data/spec/integration/shell/join/join_0.stdout +0 -16
- data/spec/integration/shell/matching/matching_0.cmd +0 -1
- data/spec/integration/shell/matching/matching_0.stdout +0 -8
- data/spec/integration/shell/minus/minus_0.cmd +0 -1
- data/spec/integration/shell/minus/minus_0.stdout +0 -4
- data/spec/integration/shell/not-matching/not-matching_0.cmd +0 -1
- data/spec/integration/shell/not-matching/not-matching_0.stdout +0 -5
- data/spec/integration/shell/project/project_0.cmd +0 -1
- data/spec/integration/shell/project/project_0.stdout +0 -9
- data/spec/integration/shell/project/project_1.cmd +0 -1
- data/spec/integration/shell/project/project_1.stdout +0 -9
- data/spec/integration/shell/quota/quota_0.cmd +0 -1
- data/spec/integration/shell/quota/quota_0.stdout +0 -16
- data/spec/integration/shell/rank/rank_1.cmd +0 -1
- data/spec/integration/shell/rank/rank_1.stdout +0 -10
- data/spec/integration/shell/rank/rank_2.cmd +0 -1
- data/spec/integration/shell/rank/rank_2.stdout +0 -10
- data/spec/integration/shell/rank/rank_3.cmd +0 -1
- data/spec/integration/shell/rank/rank_3.stdout +0 -10
- data/spec/integration/shell/rank/rank_4.cmd +0 -1
- data/spec/integration/shell/rank/rank_4.stdout +0 -6
- data/spec/integration/shell/rank/rank_5.cmd +0 -1
- data/spec/integration/shell/rank/rank_5.stdout +0 -6
- data/spec/integration/shell/rename/rename_0.cmd +0 -1
- data/spec/integration/shell/rename/rename_0.stdout +0 -9
- data/spec/integration/shell/restrict/restrict_0.cmd +0 -1
- data/spec/integration/shell/restrict/restrict_0.stdout +0 -6
- data/spec/integration/shell/restrict/restrict_1.cmd +0 -1
- data/spec/integration/shell/restrict/restrict_1.stdout +0 -6
- data/spec/integration/shell/show/show_base.cmd +0 -1
- data/spec/integration/shell/show/show_base.stdout +0 -9
- data/spec/integration/shell/show/show_base_sort_1.cmd +0 -1
- data/spec/integration/shell/show/show_base_sort_1.stdout +0 -9
- data/spec/integration/shell/show/show_base_sort_2.cmd +0 -1
- data/spec/integration/shell/show/show_base_sort_2.stdout +0 -9
- data/spec/integration/shell/show/show_conflictual.cmd +0 -1
- data/spec/integration/shell/show/show_conflictual.stdout +0 -5
- data/spec/integration/shell/show/show_csv.cmd +0 -1
- data/spec/integration/shell/show/show_csv.stdout +0 -6
- data/spec/integration/shell/show/show_ff.cmd +0 -1
- data/spec/integration/shell/show/show_ff.stdout +0 -10
- data/spec/integration/shell/show/show_rash.cmd +0 -1
- data/spec/integration/shell/show/show_rash.stdout +0 -5
- data/spec/integration/shell/show/show_rash_pretty.cmd +0 -1
- data/spec/integration/shell/show/show_rash_pretty.stdout +0 -30
- data/spec/integration/shell/show/show_yaml.cmd +0 -1
- data/spec/integration/shell/show/show_yaml.stdout +0 -22
- data/spec/integration/shell/sort/sort_0.cmd +0 -1
- data/spec/integration/shell/sort/sort_0.stdout +0 -9
- data/spec/integration/shell/sort/sort_1.cmd +0 -1
- data/spec/integration/shell/sort/sort_1.stdout +0 -9
- data/spec/integration/shell/sort/sort_2.cmd +0 -1
- data/spec/integration/shell/sort/sort_2.stdout +0 -9
- data/spec/integration/shell/sort/sort_3.cmd +0 -1
- data/spec/integration/shell/sort/sort_3.stdout +0 -9
- data/spec/integration/shell/summarize/summarize_0.cmd +0 -1
- data/spec/integration/shell/summarize/summarize_0.stdout +0 -8
- data/spec/integration/shell/ungroup/ungroup_0.cmd +0 -1
- data/spec/integration/shell/ungroup/ungroup_0.stdout +0 -16
- data/spec/integration/shell/union/union_0.cmd +0 -1
- data/spec/integration/shell/union/union_0.stdout +0 -9
- data/spec/integration/shell/unwrap/unwrap_0.cmd +0 -1
- data/spec/integration/shell/unwrap/unwrap_0.stdout +0 -9
- data/spec/integration/shell/wrap/wrap_0.cmd +0 -1
- data/spec/integration/shell/wrap/wrap_0.stdout +0 -9
- data/spec/integration/test_alf.rb +0 -34
- data/spec/integration/test_examples.rb +0 -15
- data/spec/integration/test_lispy.rb +0 -31
- data/spec/integration/test_semantics.rb +0 -40
- data/spec/integration/test_shell.rb +0 -47
- data/spec/regression/alf_file/__FILE__.alf +0 -2
- data/spec/regression/alf_file/suppliers.rash +0 -5
- data/spec/regression/alf_file/test___FILE__.rb +0 -17
- data/spec/regression/heading/test_heading_with_date.rb +0 -12
- data/spec/regression/lispy/test_compile.rb +0 -14
- data/spec/regression/logs/apache_combined.log +0 -5
- data/spec/regression/logs/test_path_attribute.rb +0 -25
- data/spec/regression/relation/test_relation_allbut_all.rb +0 -14
- data/spec/regression/relation/test_relation_with_date.rb +0 -12
- data/spec/regression/restrict/test_restrict_with_keywords.rb +0 -17
- data/spec/shared/a_valid_type_implementation.rb +0 -47
- data/spec/shared/a_value.rb +0 -12
- data/spec/shared/an_operator_class.rb +0 -36
- data/spec/unit/alf-core/aggregator/test_avg.rb +0 -22
- data/spec/unit/alf-core/aggregator/test_collect.rb +0 -25
- data/spec/unit/alf-core/aggregator/test_concat.rb +0 -31
- data/spec/unit/alf-core/aggregator/test_count.rb +0 -17
- data/spec/unit/alf-core/aggregator/test_max.rb +0 -23
- data/spec/unit/alf-core/aggregator/test_min.rb +0 -23
- data/spec/unit/alf-core/aggregator/test_stddev.rb +0 -27
- data/spec/unit/alf-core/aggregator/test_sum.rb +0 -23
- data/spec/unit/alf-core/aggregator/test_variance.rb +0 -29
- data/spec/unit/alf-core/assumptions/test_file.rb +0 -17
- data/spec/unit/alf-core/assumptions/test_instance_eval.rb +0 -15
- data/spec/unit/alf-core/assumptions/test_scoping.rb +0 -29
- data/spec/unit/alf-core/assumptions/test_set.rb +0 -64
- data/spec/unit/alf-core/environment/examples/suppliers.rash +0 -5
- data/spec/unit/alf-core/environment/test_folder.rb +0 -53
- data/spec/unit/alf-core/operator/non_relational/test_autonum.rb +0 -48
- data/spec/unit/alf-core/operator/non_relational/test_clip.rb +0 -35
- data/spec/unit/alf-core/operator/non_relational/test_coerce.rb +0 -29
- data/spec/unit/alf-core/operator/non_relational/test_compact.rb +0 -32
- data/spec/unit/alf-core/operator/non_relational/test_defaults.rb +0 -53
- data/spec/unit/alf-core/operator/non_relational/test_generator.rb +0 -60
- data/spec/unit/alf-core/operator/non_relational/test_sort.rb +0 -60
- data/spec/unit/alf-core/operator/relational/test_extend.rb +0 -28
- data/spec/unit/alf-core/operator/relational/test_group.rb +0 -39
- data/spec/unit/alf-core/operator/relational/test_heading.rb +0 -27
- data/spec/unit/alf-core/operator/relational/test_intersect.rb +0 -58
- data/spec/unit/alf-core/operator/relational/test_join.rb +0 -36
- data/spec/unit/alf-core/operator/relational/test_minus.rb +0 -56
- data/spec/unit/alf-core/operator/relational/test_project.rb +0 -62
- data/spec/unit/alf-core/operator/relational/test_quota.rb +0 -36
- data/spec/unit/alf-core/operator/relational/test_rank.rb +0 -48
- data/spec/unit/alf-core/operator/relational/test_rename.rb +0 -26
- data/spec/unit/alf-core/operator/relational/test_restrict.rb +0 -45
- data/spec/unit/alf-core/operator/relational/test_summarize.rb +0 -44
- data/spec/unit/alf-core/operator/relational/test_ungroup.rb +0 -29
- data/spec/unit/alf-core/operator/relational/test_union.rb +0 -35
- data/spec/unit/alf-core/operator/relational/test_unwrap.rb +0 -26
- data/spec/unit/alf-core/operator/relational/test_wrap.rb +0 -26
- data/spec/unit/alf-core/operator/signature/test_argv2args.rb +0 -82
- data/spec/unit/alf-core/operator/signature/test_collect_on.rb +0 -38
- data/spec/unit/alf-core/operator/signature/test_initialize.rb +0 -17
- data/spec/unit/alf-core/operator/signature/test_install.rb +0 -56
- data/spec/unit/alf-core/operator/signature/test_option_parser.rb +0 -36
- data/spec/unit/alf-core/operator/signature/test_parse_args.rb +0 -90
- data/spec/unit/alf-core/operator/signature/test_to_lispy.rb +0 -102
- data/spec/unit/alf-core/operator/signature/test_to_shell.rb +0 -103
- data/spec/unit/alf-core/operator/test_non_relational.rb +0 -20
- data/spec/unit/alf-core/operator/test_relational.rb +0 -31
- data/spec/unit/alf-core/reader/input.rb +0 -2
- data/spec/unit/alf-core/reader/test_alf_file.rb +0 -30
- data/spec/unit/alf-core/reader/test_initialize.rb +0 -60
- data/spec/unit/alf-core/reader/test_looks_a_path.rb +0 -20
- data/spec/unit/alf-core/reader/test_rash.rb +0 -31
- data/spec/unit/alf-core/relation/test_coerce.rb +0 -53
- data/spec/unit/alf-core/relation/test_inspect.rb +0 -20
- data/spec/unit/alf-core/relation/test_relops.rb +0 -55
- data/spec/unit/alf-core/relation/test_to_a.rb +0 -41
- data/spec/unit/alf-core/renderer/test_initialize.rb +0 -60
- data/spec/unit/alf-core/test_aggregator.rb +0 -58
- data/spec/unit/alf-core/test_environment.rb +0 -30
- data/spec/unit/alf-core/test_operator.rb +0 -16
- data/spec/unit/alf-core/test_reader.rb +0 -40
- data/spec/unit/alf-core/test_relation.rb +0 -75
- data/spec/unit/alf-core/test_renderer.rb +0 -53
- data/spec/unit/alf-core/text/test_cell.rb +0 -35
- data/spec/unit/alf-core/text/test_row.rb +0 -30
- data/spec/unit/alf-core/text/test_table.rb +0 -39
- data/spec/unit/alf-core/tools/test_class_name.rb +0 -16
- data/spec/unit/alf-core/tools/test_coalesce.rb +0 -19
- data/spec/unit/alf-core/tools/test_coerce.rb +0 -16
- data/spec/unit/alf-core/tools/test_ruby_case.rb +0 -16
- data/spec/unit/alf-core/tools/test_to_lispy.rb +0 -145
- data/spec/unit/alf-core/tools/test_to_relation.rb +0 -39
- data/spec/unit/alf-core/tools/test_to_ruby_literal.rb +0 -10
- data/spec/unit/alf-core/tools/test_tuple_handle.rb +0 -52
- data/spec/unit/alf-core/tools/test_tuple_heading.rb +0 -15
- data/spec/unit/alf-core/tools/test_varargs.rb +0 -19
- data/spec/unit/alf-core/types/test_attr_list.rb +0 -188
- data/spec/unit/alf-core/types/test_attr_name.rb +0 -78
- data/spec/unit/alf-core/types/test_boolean.rb +0 -42
- data/spec/unit/alf-core/types/test_class_methods.rb +0 -24
- data/spec/unit/alf-core/types/test_heading.rb +0 -146
- data/spec/unit/alf-core/types/test_ordering.rb +0 -185
- data/spec/unit/alf-core/types/test_renaming.rb +0 -72
- data/spec/unit/alf-core/types/test_size.rb +0 -74
- data/spec/unit/alf-core/types/test_summarization.rb +0 -95
- data/spec/unit/alf-core/types/test_tuple_computation.rb +0 -96
- data/spec/unit/alf-core/types/test_tuple_expression.rb +0 -122
- data/spec/unit/alf-core/types/test_tuple_predicate.rb +0 -108
- data/spec/unit/alf-csv/input.csv +0 -3
- data/spec/unit/alf-csv/test_reader.rb +0 -66
- data/spec/unit/alf-csv/test_renderer.rb +0 -73
- data/spec/unit/alf-engine/compact/test_set.rb +0 -33
- data/spec/unit/alf-engine/compact/test_uniq.rb +0 -33
- data/spec/unit/alf-engine/group/test_hash.rb +0 -34
- data/spec/unit/alf-engine/join/test_hash.rb +0 -55
- data/spec/unit/alf-engine/materialize/test_array.rb +0 -28
- data/spec/unit/alf-engine/materialize/test_hash.rb +0 -76
- data/spec/unit/alf-engine/quota/test_cesure.rb +0 -34
- data/spec/unit/alf-engine/rank/test_cesure.rb +0 -47
- data/spec/unit/alf-engine/semi/test_hash.rb +0 -58
- data/spec/unit/alf-engine/sort/test_in_memory.rb +0 -32
- data/spec/unit/alf-engine/summarize/test_cesure.rb +0 -36
- data/spec/unit/alf-engine/summarize/test_hash.rb +0 -36
- data/spec/unit/alf-engine/test_aggregate.rb +0 -26
- data/spec/unit/alf-engine/test_autonum.rb +0 -24
- data/spec/unit/alf-engine/test_clip.rb +0 -34
- data/spec/unit/alf-engine/test_coerce.rb +0 -35
- data/spec/unit/alf-engine/test_compact.rb +0 -33
- data/spec/unit/alf-engine/test_concat.rb +0 -38
- data/spec/unit/alf-engine/test_defaults.rb +0 -37
- data/spec/unit/alf-engine/test_filter.rb +0 -23
- data/spec/unit/alf-engine/test_generator.rb +0 -25
- data/spec/unit/alf-engine/test_rename.rb +0 -24
- data/spec/unit/alf-engine/test_set_attr.rb +0 -38
- data/spec/unit/alf-engine/test_sort.rb +0 -32
- data/spec/unit/alf-engine/test_ungroup.rb +0 -28
- data/spec/unit/alf-engine/test_unwrap.rb +0 -20
- data/spec/unit/alf-engine/test_wrap.rb +0 -26
- data/spec/unit/alf-logs/apache_combined.log +0 -5
- data/spec/unit/alf-logs/postgresql.log +0 -29
- data/spec/unit/alf-logs/test_reader.rb +0 -57
- data/spec/unit/alf-sequel/alf.db +0 -0
- data/spec/unit/alf-sequel/test_environment.rb +0 -74
- data/spec/unit/alf-shell/doc_manager/dynamic.md +0 -1
- data/spec/unit/alf-shell/doc_manager/example.md +0 -1
- data/spec/unit/alf-shell/doc_manager/example_1.txt +0 -11
- data/spec/unit/alf-shell/doc_manager/static.md +0 -1
- data/spec/unit/alf-shell/doc_manager/test_call.rb +0 -48
- data/spec/unit/alf-shell/main/test_class_methods.rb +0 -44
- data/spec/unit/alf-shell/operator/test_autonum.rb +0 -28
- data/spec/unit/alf-shell/operator/test_clip.rb +0 -29
- data/spec/unit/alf-shell/operator/test_coerce.rb +0 -21
- data/spec/unit/alf-shell/operator/test_compact.rb +0 -16
- data/spec/unit/alf-shell/operator/test_defaults.rb +0 -29
- data/spec/unit/alf-shell/operator/test_extend.rb +0 -21
- data/spec/unit/alf-shell/operator/test_generator.rb +0 -37
- data/spec/unit/alf-shell/operator/test_group.rb +0 -32
- data/spec/unit/alf-shell/operator/test_heading.rb +0 -16
- data/spec/unit/alf-shell/operator/test_intersect.rb +0 -18
- data/spec/unit/alf-shell/operator/test_join.rb +0 -18
- data/spec/unit/alf-shell/operator/test_matching.rb +0 -18
- data/spec/unit/alf-shell/operator/test_minus.rb +0 -18
- data/spec/unit/alf-shell/operator/test_not_matching.rb +0 -18
- data/spec/unit/alf-shell/operator/test_project.rb +0 -38
- data/spec/unit/alf-shell/operator/test_quota.rb +0 -23
- data/spec/unit/alf-shell/operator/test_rank.rb +0 -30
- data/spec/unit/alf-shell/operator/test_rename.rb +0 -21
- data/spec/unit/alf-shell/operator/test_restrict.rb +0 -35
- data/spec/unit/alf-shell/operator/test_sort.rb +0 -49
- data/spec/unit/alf-shell/operator/test_summarize.rb +0 -30
- data/spec/unit/alf-shell/operator/test_ungroup.rb +0 -28
- data/spec/unit/alf-shell/operator/test_union.rb +0 -18
- data/spec/unit/alf-shell/operator/test_unwrap.rb +0 -28
- data/spec/unit/alf-shell/operator/test_wrap.rb +0 -30
- data/tasks/clean.rake +0 -3
- data/tasks/debug_mail.rake +0 -75
- data/tasks/debug_mail.txt +0 -18
- data/tasks/gh-pages.rake +0 -68
- data/tasks/integration_test.rake +0 -43
- data/tasks/regression_test.rake +0 -44
- data/tasks/unit_test.rake +0 -44
- data/tasks/yard.rake +0 -51
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
class Text::Renderer
|
4
|
-
describe Cell do
|
5
|
-
|
6
|
-
let(:f){ Cell.new }
|
7
|
-
|
8
|
-
specify "text_rendering" do
|
9
|
-
Cell.new(100).text_rendering.should == "100"
|
10
|
-
Cell.new(:hello).text_rendering.should == ":hello"
|
11
|
-
Cell.new("hello").text_rendering.should == "hello"
|
12
|
-
Cell.new(10.0).text_rendering.should == "10.000"
|
13
|
-
Cell.new(10/3.0).text_rendering.should == "3.333"
|
14
|
-
Cell.new([]).text_rendering.should == "[]"
|
15
|
-
Cell.new([10/3.0, true]).text_rendering.should == "[3.333, true]"
|
16
|
-
Cell.new(10/3.0, {:float_format => "%.6f"}).text_rendering.should == "3.333333"
|
17
|
-
end
|
18
|
-
|
19
|
-
specify "min_width" do
|
20
|
-
Cell.new("").min_width.should == 0
|
21
|
-
Cell.new(10/3.0).min_width.should == 5
|
22
|
-
Cell.new("12\n5345").min_width.should == 4
|
23
|
-
end
|
24
|
-
|
25
|
-
specify "rendering_lines" do
|
26
|
-
Cell.new("").rendering_lines.should == []
|
27
|
-
Cell.new(10/3.0).rendering_lines.should == ["3.333"]
|
28
|
-
Cell.new([10/3.0,true]).rendering_lines.should == ["[3.333, true]"]
|
29
|
-
Cell.new("abc").rendering_lines(5).should == ["abc "]
|
30
|
-
Cell.new(12).rendering_lines(5).should == [" 12"]
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
class Text::Renderer
|
4
|
-
describe Row do
|
5
|
-
|
6
|
-
let(:row){ Row.new(values) }
|
7
|
-
|
8
|
-
describe "when single values are used only" do
|
9
|
-
|
10
|
-
let(:values){ [ 10/3.0, true ] }
|
11
|
-
specify "rendering_lines" do
|
12
|
-
row.rendering_lines.should == ["| 3.333 | true |"]
|
13
|
-
row.rendering_lines([10,5]).should == ["| 3.333 | true |"]
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "when multiple-line values are used" do
|
19
|
-
|
20
|
-
let(:values){ [ 10/3.0, [1, 2, 3] ] }
|
21
|
-
|
22
|
-
specify "rendering_lines" do
|
23
|
-
row.rendering_lines.should == ["| 3.333 | [1, 2, 3] |"]
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
class Text::Renderer
|
4
|
-
describe Table do
|
5
|
-
|
6
|
-
let(:columns){ [ :method, :total ] }
|
7
|
-
let(:table){ Table.new(records, columns) }
|
8
|
-
|
9
|
-
describe "on an empty table" do
|
10
|
-
|
11
|
-
let(:records){ [ ] }
|
12
|
-
|
13
|
-
specify "render" do
|
14
|
-
table.render.should == "+---------+--------+\n" +
|
15
|
-
"| :method | :total |\n" +
|
16
|
-
"+---------+--------+\n" +
|
17
|
-
"+---------+--------+\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "when single values are used only" do
|
23
|
-
|
24
|
-
let(:records){ [ [:by_x, 10.0], [:by_y, 2.0] ] }
|
25
|
-
|
26
|
-
specify "render" do
|
27
|
-
table.render.should == "+---------+--------+\n" +
|
28
|
-
"| :method | :total |\n" +
|
29
|
-
"+---------+--------+\n" +
|
30
|
-
"| :by_x | 10.000 |\n" +
|
31
|
-
"| :by_y | 2.000 |\n" +
|
32
|
-
"+---------+--------+\n"
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe Tools, "class_name" do
|
4
|
-
|
5
|
-
let(:tools){ Object.new.extend(Tools) }
|
6
|
-
|
7
|
-
it "should work on top-level namespaces" do
|
8
|
-
tools.class_name(Alf).should eq(:Alf)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should work on non top-level namespaces" do
|
12
|
-
tools.class_name(Alf::Tools).should eq(:Tools)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe Tools, "coalesce" do
|
4
|
-
|
5
|
-
it "should support a varargs variant" do
|
6
|
-
Tools.coalesce(:a, nil, :b, :c).should eql(:a)
|
7
|
-
Tools.coalesce(nil, :a, nil, :b, :c).should eql(:a)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should support a block for costly computations" do
|
11
|
-
Tools.coalesce(nil){ :hello }.should eql(:hello)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should return nil otherwise" do
|
15
|
-
Tools.coalesce(nil).should be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe "Tools#coerce" do
|
4
|
-
|
5
|
-
it 'should coerce integers without trouble' do
|
6
|
-
Tools.coerce("12", Integer).should eql(12)
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should raise a Alf::CoercionError in case of error' do
|
10
|
-
lambda{
|
11
|
-
Tools.coerce("abc", Integer)
|
12
|
-
}.should raise_error(Alf::CoercionError)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe Tools, "ruby_case" do
|
4
|
-
|
5
|
-
let(:tools){ Object.new.extend(Tools) }
|
6
|
-
|
7
|
-
it "should work on one word" do
|
8
|
-
tools.ruby_case(:Alf).should == "alf"
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should work on multiple words" do
|
12
|
-
tools.ruby_case(:HelloWorld).should == "hello_world"
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe Tools, ".to_lispy" do
|
4
|
-
|
5
|
-
it "should have a valid example" do
|
6
|
-
expr = Alf.lispy.compile{
|
7
|
-
(project :suppliers, [:name])
|
8
|
-
}
|
9
|
-
Tools.to_lispy(expr).should eq("(project :suppliers, [:name])")
|
10
|
-
end
|
11
|
-
|
12
|
-
subject{ Tools.to_lispy(value) }
|
13
|
-
|
14
|
-
describe "on a Proxy" do
|
15
|
-
let(:value){ Iterator::Proxy.new(Environment.examples, :suppliers) }
|
16
|
-
it { should eq(":suppliers") }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "on an AttrName" do
|
20
|
-
let(:value){ :city }
|
21
|
-
it { should eq(":city") }
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "on an AttrList" do
|
25
|
-
let(:value){ AttrList.new([:name, :city]) }
|
26
|
-
it { should eq("[:name, :city]") }
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "on a Heading" do
|
30
|
-
let(:value){ Heading.new(:name => String) }
|
31
|
-
it { should eq("{:name => String}") }
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "on an Ordering" do
|
35
|
-
let(:value){ Ordering.new([[:name, :asc], [:city, :desc]]) }
|
36
|
-
it { should eq("[[:name, :asc], [:city, :desc]]") }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "on a Renaming" do
|
40
|
-
let(:value){ Renaming.new(:old => :new) }
|
41
|
-
it { should eq("{:old => :new}") }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "on an Aggregation" do
|
45
|
-
let(:value){ Aggregator.coerce("sum{ qty*price }") }
|
46
|
-
it { should eq("sum{ qty*price }") }
|
47
|
-
end
|
48
|
-
|
49
|
-
describe "on a TupleExpression" do
|
50
|
-
let(:value){ TupleExpression.coerce(arg) }
|
51
|
-
|
52
|
-
describe "When built from a string" do
|
53
|
-
let(:arg){ "status.upcase" }
|
54
|
-
it{ should eq("->{ status.upcase }")}
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "When built from a symbol" do
|
58
|
-
let(:arg){ :status }
|
59
|
-
it{ should eq("->{ status }")}
|
60
|
-
end
|
61
|
-
|
62
|
-
end # TupleExpression
|
63
|
-
|
64
|
-
describe "on a TuplePredicate" do
|
65
|
-
let(:value){ TuplePredicate.coerce(arg) }
|
66
|
-
|
67
|
-
describe "When built from a TupleExpression" do
|
68
|
-
let(:arg){ TupleExpression.coerce("status > 10") }
|
69
|
-
it{ should eq("->{ status > 10 }")}
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "When built from a boolean" do
|
73
|
-
let(:arg){ true }
|
74
|
-
it{ should eq("->{ true }")}
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "When built from a String" do
|
78
|
-
let(:arg){ "status > 10" }
|
79
|
-
it{ should eq("->{ status > 10 }")}
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "When built from a Hash" do
|
83
|
-
let(:arg){ {:status => 10} }
|
84
|
-
it{ should eq("->{ (self.status == 10) }")}
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "When built with a singleton Array" do
|
88
|
-
let(:arg){ ["status > 10"] }
|
89
|
-
it{ should eq("->{ status > 10 }")}
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "When built with a Hash-Array" do
|
93
|
-
let(:arg){ ["status", "10"] }
|
94
|
-
it{ should eq("->{ (self.status == 10) }")}
|
95
|
-
end
|
96
|
-
|
97
|
-
describe "When built with a Hash-Array without coercion" do
|
98
|
-
let(:arg){ [:status, "10"] }
|
99
|
-
it{ should eq("->{ (self.status == \"10\") }")}
|
100
|
-
end
|
101
|
-
|
102
|
-
end # TuplePredicate
|
103
|
-
|
104
|
-
describe "on a TupleComputation" do
|
105
|
-
let(:value){ TupleComputation.coerce(arg) }
|
106
|
-
|
107
|
-
describe "When built from a Hash" do
|
108
|
-
let(:arg){ {"upcased" => "status.upcase"} }
|
109
|
-
it{ should eq("{:upcased => ->{ status.upcase }}")}
|
110
|
-
end
|
111
|
-
|
112
|
-
end # TupleComputation
|
113
|
-
|
114
|
-
describe "on a Summarization" do
|
115
|
-
let(:value){ Summarization.coerce(arg) }
|
116
|
-
|
117
|
-
describe "When built from an Array" do
|
118
|
-
let(:arg){ {"total" => "sum{ qty*price }"} }
|
119
|
-
it{ should eq("{:total => sum{ qty*price }}") }
|
120
|
-
end
|
121
|
-
|
122
|
-
end # Summarization
|
123
|
-
|
124
|
-
describe "on an nullary operator" do
|
125
|
-
let(:value){ Alf::Operator::NonRelational::Generator.new([], 10, :id) }
|
126
|
-
it { should eq("(generator 10, :id)") }
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "on an monadic operator with an option" do
|
130
|
-
let(:value){ Alf::Operator::Relational::Project.new([:suppliers], [:city], :allbut => true) }
|
131
|
-
it { should eq("(project :suppliers, [:city], {:allbut => true})") }
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "on an monadic operator with default values for options" do
|
135
|
-
let(:value){ Alf::Operator::Relational::Project.new([:suppliers], [:city]) }
|
136
|
-
it { should eq("(project :suppliers, [:city])") }
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "on an dyadic operator without no args nor any option" do
|
140
|
-
let(:value){ Alf::Operator::Relational::Join.new([:suppliers, :cities]) }
|
141
|
-
it { should eq("(join :suppliers, :cities)") }
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe "Tools#to_relation" do
|
4
|
-
|
5
|
-
let(:expected){
|
6
|
-
Relation.new(Set.new << {:name => "Alf"})
|
7
|
-
}
|
8
|
-
|
9
|
-
def to_rel(x)
|
10
|
-
Relation(x) # Relation(...) -> Alf::Relation(...) -> Tools.to_relation(...)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'delegates to to_relation if it exists' do
|
14
|
-
x = Struct.new(:to_relation).new("Hello")
|
15
|
-
to_rel(x).should eq("Hello")
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'works on Relation' do
|
19
|
-
to_rel(expected).should eq(expected)
|
20
|
-
to_rel(expected).object_id.should eq(expected.object_id)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'converts a single Hash as a singleton relation' do
|
24
|
-
tuple = {:name => "Alf"}
|
25
|
-
to_rel(tuple).should eq(expected)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'converts a list of names values to a Relation' do
|
29
|
-
tuple = {:name => ["Alf", "Myrrha"]}
|
30
|
-
expected = Relation.new(Set.new << {:name => "Alf"} << {:name => "Myrrha"})
|
31
|
-
to_rel(tuple).should eq(expected)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'converts an array of tuples' do
|
35
|
-
to_rel(expected.to_a).should eq(expected)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
module Tools
|
4
|
-
describe TupleHandle do
|
5
|
-
|
6
|
-
let(:handle){ TupleHandle.new }
|
7
|
-
|
8
|
-
it "should install methods properly" do
|
9
|
-
handle.set(:hello => "a", :world => "b")
|
10
|
-
handle.should respond_to(:hello)
|
11
|
-
handle.should respond_to(:world)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should behave correctly" do
|
15
|
-
handle.set(:hello => "a", :world => "b")
|
16
|
-
handle.hello.should == "a"
|
17
|
-
handle.world.should == "b"
|
18
|
-
handle.set(:hello => "c", :world => "d")
|
19
|
-
handle.hello.should == "c"
|
20
|
-
handle.world.should == "d"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should allow instance evaluating on exprs" do
|
24
|
-
handle.set(:tested => 1)
|
25
|
-
handle.instance_eval{ tested < 1 }.should be_false
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should support an attribute called :path" do
|
29
|
-
handle.set(:path => 1)
|
30
|
-
handle.instance_eval{ path < 1 }.should be_false
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "evaluate" do
|
34
|
-
before{ handle.set(:a => 1, :b => 2) }
|
35
|
-
|
36
|
-
it "should allow a String" do
|
37
|
-
handle.evaluate("a").should == 1
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should allow a Symbol" do
|
41
|
-
handle.evaluate(:a).should == 1
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should allow a Proc" do
|
45
|
-
handle.evaluate(lambda{ a }).should == 1
|
46
|
-
end
|
47
|
-
|
48
|
-
end # evaluate
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Alf
|
3
|
-
describe Tools, "tuple_heading" do
|
4
|
-
|
5
|
-
it 'should work on the empty tuple' do
|
6
|
-
Tools.tuple_heading({}).should eq(Heading::EMPTY)
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should work on a supplier-like tuple' do
|
10
|
-
expected = Heading[:name => String, :old => FalseClass]
|
11
|
-
Tools.tuple_heading(:name => "Jones", :old => false).should eq(expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|