[386] | 1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
| 2 | include OpenEHR::AM::Archetype::Assertion
|
---|
| 3 |
|
---|
| 4 | describe OperatorKind do
|
---|
| 5 | it 'op_eq should be equal 2001' do
|
---|
| 6 | OperatorKind::OP_EQ.should be_equal 2001
|
---|
| 7 | end
|
---|
| 8 |
|
---|
| 9 | it 'op_ne should be equal 2002' do
|
---|
| 10 | OperatorKind::OP_NE.should be_equal 2002
|
---|
| 11 | end
|
---|
| 12 |
|
---|
| 13 | it 'op_le should be equal 2004' do
|
---|
| 14 | OperatorKind::OP_LE.should be_equal 2003
|
---|
| 15 | end
|
---|
| 16 |
|
---|
| 17 | it 'op_lt should be equal 2004' do
|
---|
| 18 | OperatorKind::OP_LT.should be_equal 2004
|
---|
| 19 | end
|
---|
| 20 |
|
---|
| 21 | it 'op_ge should be equal 2005' do
|
---|
| 22 | OperatorKind::OP_GE.should be_equal 2005
|
---|
| 23 | end
|
---|
| 24 |
|
---|
| 25 | it 'op_gt should be equal 2006' do
|
---|
| 26 | OperatorKind::OP_GT.should be_equal 2006
|
---|
| 27 | end
|
---|
| 28 |
|
---|
| 29 | it 'op_not should be equal 2010' do
|
---|
| 30 | OperatorKind::OP_NOT.should be_equal 2010
|
---|
| 31 | end
|
---|
| 32 |
|
---|
| 33 | it 'op_and should be equal 2011' do
|
---|
| 34 | OperatorKind::OP_AND.should be_equal 2011
|
---|
| 35 | end
|
---|
| 36 |
|
---|
| 37 | it 'op_or should be equal 2012' do
|
---|
| 38 | OperatorKind::OP_OR.should be_equal 2012
|
---|
| 39 | end
|
---|
| 40 |
|
---|
| 41 | it 'op_xor should be equal 2013' do
|
---|
| 42 | OperatorKind::OP_XOR.should be_equal 2013
|
---|
| 43 | end
|
---|
| 44 |
|
---|
| 45 | it 'op_implies should be equal 2014' do
|
---|
| 46 | OperatorKind::OP_IMPLIES.should be_equal 2014
|
---|
| 47 | end
|
---|
| 48 |
|
---|
| 49 | it 'op_for_all should be equal 2015' do
|
---|
| 50 | OperatorKind::OP_FOR_ALL.should be_equal 2015
|
---|
| 51 | end
|
---|
| 52 |
|
---|
| 53 | it 'op_exists should be equal 2016' do
|
---|
| 54 | OperatorKind::OP_EXISTS.should be_equal 2016
|
---|
| 55 | end
|
---|
| 56 |
|
---|
| 57 | it 'op_plus should be equal 2020' do
|
---|
| 58 | OperatorKind::OP_PLUS.should be_equal 2020
|
---|
| 59 | end
|
---|
| 60 |
|
---|
| 61 | it 'op_minus should be equal 2021' do
|
---|
| 62 | OperatorKind::OP_MINUS.should be_equal 2021
|
---|
| 63 | end
|
---|
| 64 |
|
---|
| 65 | it 'op_multiply should be equal 2022' do
|
---|
| 66 | OperatorKind::OP_MULTIPLY.should be_equal 2022
|
---|
| 67 | end
|
---|
| 68 |
|
---|
| 69 | it 'op_divide should be equal 2023' do
|
---|
| 70 | OperatorKind::OP_DIVIDE.should be_equal 2023
|
---|
| 71 | end
|
---|
| 72 |
|
---|
| 73 | it 'op_exp should be equal 2024' do
|
---|
| 74 | OperatorKind::OP_EXP.should be_equal 2024
|
---|
| 75 | end
|
---|
| 76 |
|
---|
| 77 | it '2000 should not be valid operator' do
|
---|
| 78 | OperatorKind.should_not be_valid_operator 2000
|
---|
| 79 | end
|
---|
| 80 |
|
---|
| 81 | it '2001 should be valid operator' do
|
---|
| 82 | OperatorKind.should be_valid_operator 2001
|
---|
| 83 | end
|
---|
| 84 |
|
---|
| 85 | it '2024 should be valid operator' do
|
---|
| 86 | OperatorKind.should be_valid_operator 2024
|
---|
| 87 | end
|
---|
| 88 |
|
---|
| 89 | it '2025 should not be valid operator' do
|
---|
| 90 | OperatorKind.should_not be_valid_operator 2025
|
---|
| 91 | end
|
---|
[387] | 92 |
|
---|
| 93 | describe 'value should be assigned' do
|
---|
| 94 | before(:each) do
|
---|
| 95 | @operator_kind = OperatorKind.new(:value => 2001)
|
---|
| 96 | end
|
---|
| 97 |
|
---|
| 98 | it 'value should be assigned' do
|
---|
| 99 | @operator_kind.value.should be_equal 2001
|
---|
| 100 | end
|
---|
| 101 |
|
---|
| 102 | it 'should raise ArgumentError with invalid value' do
|
---|
| 103 | lambda {
|
---|
| 104 | @operator_kind.value = 10001
|
---|
| 105 | }.should raise_error ArgumentError
|
---|
| 106 | end
|
---|
| 107 | end
|
---|
[386] | 108 | end
|
---|
| 109 |
|
---|
| 110 |
|
---|