PageRenderTime 15ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/src/wrappers/gobject/examples/g_value_example.e

http://github.com/tybor/Liberty
Specman e | 41 lines | 38 code | 3 blank | 0 comment | 0 complexity | f64b2d51e7bdd46815a91368d3d18579 MD5 | raw file
 1indexing
 2	copyright: "(C) 2005 Paolo Redaelli "
 3	license: "LGPL v2 or later"
 4	date: "$Date:$"
 5	revision "$REvision:$"
 6
 7class G_VALUE_EXAMPLE
 8insert
 9	G_TYPE_EXTERNALS
10	G_PARAM_FLAGS
11creation make
12feature make is
13		do
14			g_type_init
15			create bool.from_boolean (True)
16			create int.from_integer (-12)
17			create uint.from_natural (23)
18			create real.from_real (23.53)
19			create string.from_string ("Foo")
20			create int_param.make_integer ("int-foo", "integer parameter", "an integer parameter",
21													 -5,12,3, g_param_readable)
22			check
23				correct_bool: bool.is_boolean
24				correct_int: int.is_integer
25				correct_uint: uint.is_natural
26				correct_real: real.is_real
27				correct_string: string.is_string
28			end
29			print ("Bool is "+bool.boolean.to_string+"%N") 
30			print ("int is "+int.integer.to_string+"%N")
31			print ("uint is "+uint.natural.to_string+"%N")
32			print ("real is "+real.real.to_string+"%N")
33			print ("string is '"+string.string+"'%N")
34			print (int_param.name + " has default " + int_param.default_integer.out + "%N")
35		end
36
37feature -- generic values
38	bool, int, uint, real, string: G_VALUE
39	int_param: G_PARAM_SPEC
40end
41