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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [spec/] [lib_inc_spec.rb] - Blame information for rev 6

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

Line No. Rev Author Line
1 3 feddischso
###############################################################
2
#
3
#  File:      lib_inc_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::HDLFile
37
#
38
#
39
#
40
###############################################################
41
 
42
describe SOCMaker::LibInc, "structure verification for loading a library-include reference" do
43
 
44
   it "should return an object of type SOCMaker::LibInf when creating with new" do
45
      o = SOCMaker::LibInc.new( 'dirs' => [ 'a/dir/ectory' ] )
46
      o.class.should be SOCMaker::LibInc
47
   end
48
 
49
   it "should raise an error, if no paths are given" do
50
      expect{ SOCMaker::LibInc.new  }.
51
         to raise_error( SOCMaker::ERR::StructureError )
52
   end
53
 
54
   it "should raise an error, if nil is given as path" do
55
      expect{ SOCMaker::LibInc.new( 'dirs' => nil )  }.
56
         to raise_error( SOCMaker::ERR::StructureError )
57
   end
58
 
59
   it "should raise an error, if paths are not given as array" do
60
      expect{ SOCMaker::LibInc.new( 'dirs' => { p1: "1" } )  }.
61
         to raise_error( SOCMaker::ERR::ValueError )
62
   end
63
 
64
   it "should raise an error, a path is an empty string" do
65
      expect{ SOCMaker::LibInc.new( 'dirs' => ["valid/path", "" ] )  }.
66
         to raise_error( SOCMaker::ERR::ValueError )
67
   end
68
 
69
   it "should raise an error, a path is not a string" do
70
      expect{ SOCMaker::LibInc.new( 'dirs' => ["valid/path", 3 ] )  }.
71
         to raise_error( SOCMaker::ERR::ValueError )
72
   end
73
end
74
 
75
describe SOCMaker::LibInc, "object handling, en-decoding:" do
76
 
77
  it "should be possible to encode and decode a core instance" do
78
    o1 = SOCMaker::LibInc.new( 'dirs' => [ 'a/dir/ectory' ] )
79
    yaml_str = o1.to_yaml
80
    o2 = YAML::load( yaml_str )
81
    o1.should be == o2
82
  end
83
 
84
  it "should return false for two non-equal objects" do
85
    o1 = SOCMaker::LibInc.new( 'dirs' => [ 'a/dir/ectory' ] )
86
    o2 = Marshal::load(Marshal.dump(o1))
87
    o2.dirs[ 0 ] << "X"
88
    ( o2 == o1 ).should be == false
89
  end
90
 
91
end
92
 

powered by: WebSVN 2.1.0

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