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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [spec/] [ifc_port_spec.rb] - Blame information for rev 9

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 feddischso
###############################################################
2
#
3
#  File:      ifc_port_spec.rb
4
#
5
#  Author:    Christian Hättich
6
#
7
#  Project:   System-On-Chip Maker
8
#
9
#  Target:    Linux / Windows / Mac
10
#
11
#  Language:  ruby
12
#
13
#
14
###############################################################
15
#
16
#
17
#   Copyright (C) 2014  Christian Hättich  - feddischson [ at ] opencores.org
18
#
19
#   This program is free software: you can redistribute it and/or modify
20
#   it under the terms of the GNU General Public License as published by
21
#   the Free Software Foundation, either version 3 of the License, or
22
#   (at your option) any later version.
23
#
24
#   This program is distributed in the hope that it will be useful,
25
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
26
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
#   GNU General Public License for more details.
28
#
29
#   You should have received a copy of the GNU General Public License
30
#   along with this program.  If not, see .
31
#
32
#
33
###############################################################
34
#
35
#   Description:
36
#     Test specification for SOCMaker::IfcPort
37
#
38
#
39
#
40
#
41
###############################################################
42
require_relative( 'spec_helper' )
43
 
44
 
45
 
46
 
47
describe SOCMaker::IfcPort, "verification" do
48
 
49
  it "should return an object of type SOCMaker::IfcPort when creating it with new" do
50
    o = SOCMaker::IfcPort.new( "abc", 1 )
51
    o.class.should be SOCMaker::IfcPort
52
  end
53
 
54
  it "should raise an error if the definition reference is nil" do
55
    expect{ SOCMaker::IfcPort.new( nil, 1 ) }.
56
    to raise_error( SOCMaker::ERR::StructureError )
57
  end
58
 
59
  it "should raise an error if the definition reference is an empty string" do
60
    expect{ SOCMaker::IfcPort.new( "", 1 ) }.
61
    to raise_error( SOCMaker::ERR::ValueError )
62
  end
63
 
64
  it "should raise an error if the length is neither a fixnum nor a string" do
65
    expect{ SOCMaker::IfcPort.new( "abc", {} ) }.
66
    to raise_error( SOCMaker::ERR::ValueError )
67
  end
68
end
69
 
70
describe SOCMaker::IfcPort, "object handling, en-decoding:" do
71
 
72
  it "should return false for two non-equal objects" do
73
    o1 = SOCMaker::IfcPort.new( "abc", 1 )
74
    o2 = Marshal::load(Marshal.dump(o1))
75
    o2.len = 4
76
    ( o2 == o1 ).should be == false
77
  end
78
 
79
  it "should be possible to encode and decode a interface definition" do
80
    o1 = SOCMaker::IfcPort.new( "abc", 1 )
81
    yaml_str = o1.to_yaml
82
    o2 = YAML::load( yaml_str )
83
    o1.should be == o2
84
  end
85
 
86
end
87
 
88
 
89
# vim: noai:ts=2:sw=2
90
 
91
 

powered by: WebSVN 2.1.0

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