/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

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