OpenCores
URL https://opencores.org/ocsvn/soc_maker/soc_maker/trunk

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [spec/] [lib_spec.rb] - Diff between revs 9 and 10

Show entire file | Details | Blame | View Log

Rev 9 Rev 10
Line 109... Line 109...
 
 
 
 
    describe "library access" do
    describe "library access" do
      it "should be possible to add, get and remove a core" do
      it "should be possible to add, get and remove a core" do
        file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
        file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
        c = SOCMaker::CoreDef.new( "acore", "v1", file, "top" )
        c = SOCMaker::CoreDef.new( "A core", "acore,v1", file, "top" )
        @lib.add_core( c )
        @lib.add_core( c )
        @lib.get_core( "acore", "v1" ).should be == c
        @lib.get_core( "acore,v1" ).should be == c
        @lib.rm_core( c )
        @lib.rm_core( c )
        expect { @lib.get_core( "acore", "v1" ) }.
        expect { @lib.get_core( "acore,v1" ) }.
          to raise_error( SOCMaker::ERR::LibError )
          to raise_error( SOCMaker::ERR::LibError )
      end
      end
 
 
      it "should be possible to add, get and remove an interface" do
      it "should be possible to add, get and remove an interface" do
        i = SOCMaker::IfcSpc.new( "myifc", "v2" )
        i = SOCMaker::IfcSpc.new( "My Interface", "myifc,v2" )
 
 
 
        # removing with instance
        @lib.add_ifc( i )
        @lib.add_ifc( i )
        @lib.get_ifc( "myifc", "v2" ).should be == i
        @lib.get_ifc( "myifc,v2" ).should be == i
        @lib.rm_ifc( i )
        @lib.rm_ifc( i )
        expect { @lib.get_ifc( "myifc", "v2" ) }.
 
 
        expect { @lib.get_ifc( "myifc,v2" ) }.
          to raise_error( SOCMaker::ERR::LibError )
          to raise_error( SOCMaker::ERR::LibError )
 
 
 
        # removing with id
 
        @lib.add_ifc( i )
 
        @lib.get_ifc( "myifc,v2" ).should be == i
 
        @lib.rm_ifc( i.id )
 
 
 
        expect { @lib.get_ifc( "myifc,v2" ) }.
 
          to raise_error( SOCMaker::ERR::LibError )
 
 
      end
      end
 
 
      it "should process all folders in add_include" do
      it "should process all folders in add_include" do
        all_folders = ["folder_a", "folder_b", "folder_c" ]
        all_folders = ["folder_a", "folder_b", "folder_c" ]
        i = SOCMaker::LibInc.new( 'dirs' => all_folders  )
        i = SOCMaker::LibInc.new( 'dirs' => all_folders  )
Line 141... Line 153...
        end
        end
      end
      end
 
 
      it "should load all elements from our test library" do
      it "should load all elements from our test library" do
        @lib.refresh( './spec/test_soc_lib' )
        @lib.refresh( './spec/test_soc_lib' )
        core_A      = @lib.get_core( "core_A", "rel1"  )
        core_A      = @lib.get_core( "core_A,rel1"  )
        core_B      = @lib.get_core( "core_B", "rel1"  )
        core_B      = @lib.get_core( "core_B,rel1"  )
        core_AB_ifc = @lib.get_ifc( "core_AB_ifc", "1" )
        core_AB_ifc = @lib.get_ifc( "core_AB_ifc,1" )
        core_A.class.should       be SOCMaker::CoreDef
        core_A.class.should       be SOCMaker::CoreDef
        core_B.class.should       be SOCMaker::CoreDef
        core_B.class.should       be SOCMaker::CoreDef
        core_AB_ifc.class.should  be SOCMaker::IfcSpc
        core_AB_ifc.class.should  be SOCMaker::IfcSpc
        core_A.static_parameters.size.should be == 3
        core_A.static_parameters.size.should be == 3
      end
      end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.