Line 47... |
Line 47... |
describe SOCMaker::IfcSpc, "verification" do
|
describe SOCMaker::IfcSpc, "verification" do
|
|
|
IFC_YAML_VALID = """
|
IFC_YAML_VALID = """
|
SOCM_IFC_SPC
|
SOCM_IFC_SPC
|
name: core_ifc
|
name: core_ifc
|
version: '1'
|
id: 'core_ifc,1'
|
ports:
|
ports:
|
:sig_a:
|
:sig_a:
|
:dir: 1
|
:dir: 1
|
:sig_b:
|
:sig_b:
|
:dir: 1
|
:dir: 1
|
Line 60... |
Line 60... |
"""
|
"""
|
|
|
IFC_YAML_INVALID = """
|
IFC_YAML_INVALID = """
|
SOCM_IFC_SPC
|
SOCM_IFC_SPC
|
:name: core_ifc
|
:name: core_ifc
|
:version: '1'
|
:id: 'core_ifc,1'
|
:ports:
|
:ports:
|
:sig_a: '12'
|
:sig_a: '12'
|
:sig_b: 1
|
:sig_b: 1
|
:sig_c: 0
|
:sig_c: 0
|
"""
|
"""
|
|
|
IFC_YAML_INVALID2 = """
|
IFC_YAML_INVALID2 = """
|
SOCM_IFC_SPC
|
SOCM_IFC_SPC
|
:name: core_ifc
|
:name: core_ifc
|
:version: '1'
|
:id: 'core_ifc,1'
|
:ports:
|
:ports:
|
:sig_a:
|
:sig_a:
|
:sig_b: 1
|
:sig_b: 1
|
:sig_c: 0
|
:sig_c: 0
|
"""
|
"""
|
Line 92... |
Line 92... |
it "should raise an error if the name is an empty string" do
|
it "should raise an error if the name is an empty string" do
|
expect{ SOCMaker::IfcSpc.new( "", "v1", { :p1 => "a-string" } ) }.
|
expect{ SOCMaker::IfcSpc.new( "", "v1", { :p1 => "a-string" } ) }.
|
to raise_error( SOCMaker::ERR::ValueError )
|
to raise_error( SOCMaker::ERR::ValueError )
|
end
|
end
|
|
|
it "should raise an error if the version is not a string" do
|
it "should raise an error if the id is not a string" do
|
expect{ SOCMaker::IfcSpc.new( "myifc", 234, { :p1 => "a-string" } ) }.
|
expect{ SOCMaker::IfcSpc.new( "myifc", 234, { :p1 => "a-string" } ) }.
|
to raise_error( SOCMaker::ERR::ValueError )
|
to raise_error( SOCMaker::ERR::ValueError )
|
end
|
end
|
|
|
it "should raise an error if the version is an a empty string" do
|
it "should raise an error if the id is an a empty string" do
|
expect{ SOCMaker::IfcSpc.new( "myifc", "", { :p1 => "a-string" } ) }.
|
expect{ SOCMaker::IfcSpc.new( "myifc", "", { :p1 => "a-string" } ) }.
|
to raise_error( SOCMaker::ERR::ValueError )
|
to raise_error( SOCMaker::ERR::ValueError )
|
end
|
end
|
|
|
|
|
it "should raise an error if a port direction is neither 0 nor 1" do
|
it "should raise an error if a port direction is neither 0 nor 1" do
|
expect{ SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { :p1 => "a-string" } ) }.
|
expect{ SOCMaker::IfcSpc.new( "myifc", "myifc,v1", 'ports' => { :p1 => "a-string" } ) }.
|
to raise_error( SOCMaker::ERR::ValueError )
|
to raise_error( SOCMaker::ERR::ValueError )
|
end
|
end
|
|
|
it "should load from yaml" do
|
it "should load from yaml" do
|
c = SOCMaker::from_s( IFC_YAML_VALID )
|
c = SOCMaker::from_s( IFC_YAML_VALID )
|