finitio 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/CHANGELOG.md +10 -0
 - data/Gemfile +1 -1
 - data/Gemfile.lock +40 -41
 - data/lib/finitio/generation.rb +106 -0
 - data/lib/finitio/generation/ad_type.rb +10 -0
 - data/lib/finitio/generation/alias_type.rb +9 -0
 - data/lib/finitio/generation/any_type.rb +11 -0
 - data/lib/finitio/generation/builtin_type.rb +9 -0
 - data/lib/finitio/generation/hash_based_type.rb +15 -0
 - data/lib/finitio/generation/heuristic.rb +8 -0
 - data/lib/finitio/generation/heuristic/constant.rb +30 -0
 - data/lib/finitio/generation/heuristic/random.rb +52 -0
 - data/lib/finitio/generation/rel_based_type.rb +13 -0
 - data/lib/finitio/generation/seq_type.rb +13 -0
 - data/lib/finitio/generation/set_type.rb +13 -0
 - data/lib/finitio/generation/sub_type.rb +9 -0
 - data/lib/finitio/generation/union_type.rb +10 -0
 - data/lib/finitio/inference.rb +51 -0
 - data/lib/finitio/support.rb +18 -0
 - data/lib/finitio/support/attribute.rb +8 -0
 - data/lib/finitio/support/compilation.rb +18 -18
 - data/lib/finitio/support/contract.rb +8 -0
 - data/lib/finitio/support/fetch_scope.rb +19 -0
 - data/lib/finitio/support/heading.rb +36 -1
 - data/lib/finitio/syntax.rb +1 -1
 - data/lib/finitio/syntax/lexer.citrus +1 -1
 - data/lib/finitio/syntax/type.rb +2 -0
 - data/lib/finitio/syntax/type/high_order_type_instantiation.rb +29 -0
 - data/lib/finitio/syntax/type/high_order_vars.rb +16 -0
 - data/lib/finitio/syntax/type/type_def.rb +11 -1
 - data/lib/finitio/syntax/types.citrus +14 -1
 - data/lib/finitio/system.rb +11 -1
 - data/lib/finitio/type.rb +19 -0
 - data/lib/finitio/type/ad_type.rb +8 -0
 - data/lib/finitio/type/alias_type.rb +8 -0
 - data/lib/finitio/type/any_type.rb +12 -0
 - data/lib/finitio/type/builtin_type.rb +4 -0
 - data/lib/finitio/type/collection_type.rb +15 -0
 - data/lib/finitio/type/heading_based_type.rb +17 -0
 - data/lib/finitio/type/high_order_type.rb +39 -0
 - data/lib/finitio/type/multi_relation_type.rb +4 -0
 - data/lib/finitio/type/multi_tuple_type.rb +4 -0
 - data/lib/finitio/type/proxy_type.rb +10 -20
 - data/lib/finitio/type/relation_type.rb +4 -0
 - data/lib/finitio/type/seq_type.rb +1 -1
 - data/lib/finitio/type/struct_type.rb +8 -0
 - data/lib/finitio/type/sub_type.rb +8 -0
 - data/lib/finitio/type/tuple_type.rb +4 -0
 - data/lib/finitio/type/union_type.rb +19 -0
 - data/lib/finitio/version.rb +1 -1
 - data/spec/generation/test_generation.rb +169 -0
 - data/spec/heading/test_looks_similar.rb +45 -0
 - data/spec/heading/test_suppremum.rb +56 -0
 - data/spec/inference/test_inference.rb +42 -0
 - data/spec/spec_helper.rb +31 -6
 - data/spec/support/test_compare_attrs.rb +67 -0
 - data/spec/syntax/test_compile.rb +57 -0
 - data/spec/type/ad_type/test_initialize.rb +1 -8
 - data/spec/type/relation_type/test_suppremum.rb +104 -0
 - data/spec/type/seq_type/test_suppremum.rb +54 -0
 - data/spec/type/set_type/test_suppremum.rb +54 -0
 - data/spec/type/test_suppremum.rb +49 -0
 - data/spec/type/test_unconstrained.rb +150 -0
 - data/spec/type/tuple_type/test_suppremum.rb +119 -0
 - data/spec/type/union_type/test_suppremum.rb +51 -0
 - data/tasks/test.rake +1 -1
 - metadata +183 -144
 - data/spec/type/proxy_type/test_delegation.rb +0 -37
 - data/spec/type/proxy_type/test_resolve.rb +0 -29
 
| 
         @@ -1,37 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            module Finitio
         
     | 
| 
       3 
     | 
    
         
            -
              describe ProxyType, "delegation pattern" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                let(:proxy){ ProxyType.new('Int', intType) }
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                it 'should delegate name' do
         
     | 
| 
       8 
     | 
    
         
            -
                  expect(proxy.name).to eq(intType.name)
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                it 'should delegate default_name' do
         
     | 
| 
       12 
     | 
    
         
            -
                  expect(proxy.default_name).to eq(intType.default_name)
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                it 'should delegate hash' do
         
     | 
| 
       16 
     | 
    
         
            -
                  expect(proxy.hash).to eq(intType.hash)
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                it 'should delegate ==' do
         
     | 
| 
       20 
     | 
    
         
            -
                  expect(intType == proxy).to eq(true)
         
     | 
| 
       21 
     | 
    
         
            -
                  expect(proxy == intType).to eq(true)
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                it 'should delegate dress' do
         
     | 
| 
       25 
     | 
    
         
            -
                  expect(proxy.dress(12)).to eq(12)
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                it 'should delegate include?' do
         
     | 
| 
       29 
     | 
    
         
            -
                  expect(proxy.include?(12)).to eq(true)
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                it 'should delegate to_s' do
         
     | 
| 
       33 
     | 
    
         
            -
                  expect(proxy.to_s).to eq(intType.to_s)
         
     | 
| 
       34 
     | 
    
         
            -
                end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,29 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            module Finitio
         
     | 
| 
       3 
     | 
    
         
            -
              describe ProxyType, "delegation pattern" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                let(:proxy){ ProxyType.new('Int') }
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                subject{ proxy.resolve(system) }
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                context 'when type exists' do
         
     | 
| 
       10 
     | 
    
         
            -
                  let(:system){ {'Int' => intType} }
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  it 'resolves fine' do
         
     | 
| 
       13 
     | 
    
         
            -
                    subject
         
     | 
| 
       14 
     | 
    
         
            -
                    expect(proxy.target).to eq(intType)
         
     | 
| 
       15 
     | 
    
         
            -
                  end
         
     | 
| 
       16 
     | 
    
         
            -
                end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                context 'when type does not exist' do
         
     | 
| 
       19 
     | 
    
         
            -
                  let(:system){ {} }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  it 'raises an error' do
         
     | 
| 
       22 
     | 
    
         
            -
                    expect{
         
     | 
| 
       23 
     | 
    
         
            -
                      subject
         
     | 
| 
       24 
     | 
    
         
            -
                    }.to raise_error(Finitio::Error, "No such type `Int`")
         
     | 
| 
       25 
     | 
    
         
            -
                  end
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
            end
         
     |