#!/usr/bin/env python
#
# Crap test to check that Slots act as Collections in the
# unionWith, setDifference and intersectWith operations.
#

import coral
L = coral.lang.UML14
m = L.Model()

c1 = L.Class(name = "C1")
c2 = L.Class(name = "C2")

s1 = coral.Set()
s1.add(c1)

m.ownedElement.add(c2)

s1.unionWith(m.ownedElement)

assert s1.size() == 2
assert c1 in s1
assert c2 in s1

s = s1.setDifference(m.ownedElement)
assert s.size() == 1
assert c1 in s
assert c2 not in s

s1.intersectWith(m.ownedElement)
assert s1.size() == 1
assert c2 in s1
