#!/usr/bin/env python
#
# Due to ECORE, we need to support default values for at
# least primitive data
#

import coral

L = coral.Language("MyLanguage", 0, 1)
M = coral.ElementDefinition(L, "MyMetaClass")

p1 = coral.Property("pString", coral.String, "",
                    1, 1, coral.kind_t.KIND_COMPOSITION,
                    "This Is The Default String Value")

p2 = coral.Property("pInteger", coral.Integer, "",
                    1, 1, coral.kind_t.KIND_COMPOSITION,
                    "42")

p3 = coral.Property("pDouble", coral.Double, "",
                    1, 1, coral.kind_t.KIND_COMPOSITION,
                    "69.0")

p4 = coral.Property("pBoolean", coral.Boolean, "",
                    1, 1, coral.kind_t.KIND_COMPOSITION,
                    "true")

M.addPropertyRecursive(p1)
M.addPropertyRecursive(p2)
M.addPropertyRecursive(p3)
M.addPropertyRecursive(p4)

m = M()

print m.pString
print m.pInteger
print m.pDouble
print m.pBoolean
assert m.pString == "This Is The Default String Value"
assert m.pInteger == 42
assert m.pDouble == 69.0
assert m.pBoolean == "true"

print "*** Default property values are OK! ***"
print "*** QUITTING ***"
