David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame^] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
Kevin Clark | 28580f4 | 2008-06-18 00:49:17 +0000 | [diff] [blame] | 20 | require File.join(File.dirname(__FILE__), '../test_helper') |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 21 | require 'SmallService' |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 22 | |
Kevin Clark | 28580f4 | 2008-06-18 00:49:17 +0000 | [diff] [blame] | 23 | class TestStructGeneration < Test::Unit::TestCase |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 24 | |
Kevin Clark | 28580f4 | 2008-06-18 00:49:17 +0000 | [diff] [blame] | 25 | def test_default_values |
Kevin Clark | d5c98ee | 2008-06-18 00:51:45 +0000 | [diff] [blame] | 26 | hello = TestNamespace::Hello.new |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 27 | |
Kevin Clark | d5c98ee | 2008-06-18 00:51:45 +0000 | [diff] [blame] | 28 | assert_kind_of(TestNamespace::Hello, hello) |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 29 | assert_nil(hello.complexer) |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 30 | |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 31 | assert_equal(hello.simple, 53) |
| 32 | assert_equal(hello.words, 'words') |
| 33 | |
Kevin Clark | d5c98ee | 2008-06-18 00:51:45 +0000 | [diff] [blame] | 34 | assert_kind_of(TestNamespace::Goodbyez, hello.thinz) |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 35 | assert_equal(hello.thinz.val, 36632) |
| 36 | |
| 37 | assert_kind_of(Hash, hello.complex) |
| 38 | assert_equal(hello.complex, { 6243 => 632, 2355 => 532, 23 => 532}) |
Kevin Clark | 4bd8916 | 2008-07-08 00:47:49 +0000 | [diff] [blame] | 39 | |
| 40 | bool_passer = TestNamespace::BoolPasser.new(:value => false) |
| 41 | assert_equal false, bool_passer.value |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 42 | end |
| 43 | |
| 44 | def test_goodbyez |
Kevin Clark | d5c98ee | 2008-06-18 00:51:45 +0000 | [diff] [blame] | 45 | assert_equal(TestNamespace::Goodbyez.new.val, 325) |
Mark Slee | 89f5716 | 2008-01-10 00:53:08 +0000 | [diff] [blame] | 46 | end |
| 47 | |
| 48 | end |