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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [spec/] [parameter_spec.rb] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 feddischso
###############################################################
2
#
3
#  File:      parameter_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::Parameter
37
#
38
#
39
#
40
#
41
###############################################################
42
require_relative( 'spec_helper' )
43
 
44
 
45
 
46
 
47
describe SOCMaker::Parameter, "verification" do
48
 
49
  # type is missing for param1
50
  F_YAML_INSTP_TYPE = '''SOCM_CORE
51
name: core_A
52
version: rel1
53
toplevel: top_A
54
hdlfiles:
55
   :core_a.vhd: SOCM_HDL_FILE
56
      :path: ./core_a.vhd
57
inst_parameters:
58
  :param1: SOCM_PARAM
59
    :min: 0
60
'''
61
 
62
 
63
  it "should return an object of type SOCMaker::Parameter when creating it with new" do
64
    o = SOCMaker::Parameter.new( "integer" )
65
    o.class.should be SOCMaker::Parameter
66
  end
67
 
68
 
69
  it "should raise an error if the type is not a string" do
70
    expect{ SOCMaker::Parameter.new( 3 ) }.
71
    to raise_error( SOCMaker::ERR::ValueError )
72
  end
73
 
74
  it "should raise an error if the type is a string with zero length" do
75
    expect{ SOCMaker::Parameter.new( "" ) }.
76
    to raise_error( SOCMaker::ERR::ValueError )
77
  end
78
 
79
  it "should raise an error if the type is nil" do
80
    expect{ SOCMaker::Parameter.new( "" ) }.
81
    to raise_error( SOCMaker::ERR::ValueError )
82
  end
83
 
84
  it 'should raise an error if the type value of an instance param. is empty' do
85
    expect{ SOCMaker::from_s( F_YAML_INSTP_TYPE ) }.
86
    to raise_error( SOCMaker::ERR::StructureError )
87
  end
88
 
89
end
90
 
91
 
92
# vim: noai:ts=2:sw=2
93
 
94
 
95
 

powered by: WebSVN 2.1.0

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