blob: fbb4776baa94a10d71a941e38b734457d1ef5c56 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001#
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 Clark28580f42008-06-18 00:49:17 +000020require File.join(File.dirname(__FILE__), '../test_helper')
Mark Slee89f57162008-01-10 00:53:08 +000021require 'SmallService'
Mark Slee89f57162008-01-10 00:53:08 +000022
Kevin Clark28580f42008-06-18 00:49:17 +000023class TestStructGeneration < Test::Unit::TestCase
Mark Slee89f57162008-01-10 00:53:08 +000024
Kevin Clark28580f42008-06-18 00:49:17 +000025 def test_default_values
Kevin Clarkd5c98ee2008-06-18 00:51:45 +000026 hello = TestNamespace::Hello.new
Mark Slee89f57162008-01-10 00:53:08 +000027
Kevin Clarkd5c98ee2008-06-18 00:51:45 +000028 assert_kind_of(TestNamespace::Hello, hello)
Mark Slee89f57162008-01-10 00:53:08 +000029 assert_nil(hello.complexer)
David Reiss0c90f6f2008-02-06 22:18:40 +000030
Mark Slee89f57162008-01-10 00:53:08 +000031 assert_equal(hello.simple, 53)
32 assert_equal(hello.words, 'words')
33
Kevin Clarkd5c98ee2008-06-18 00:51:45 +000034 assert_kind_of(TestNamespace::Goodbyez, hello.thinz)
Mark Slee89f57162008-01-10 00:53:08 +000035 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 Clark4bd89162008-07-08 00:47:49 +000039
40 bool_passer = TestNamespace::BoolPasser.new(:value => false)
41 assert_equal false, bool_passer.value
Mark Slee89f57162008-01-10 00:53:08 +000042 end
43
44 def test_goodbyez
Kevin Clarkd5c98ee2008-06-18 00:51:45 +000045 assert_equal(TestNamespace::Goodbyez.new.val, 325)
Mark Slee89f57162008-01-10 00:53:08 +000046 end
47
48end