#!/usr/bin/env python
import coral
import time

L = coral.lang.UML14

times = 3000000

m = L.Model()

t_start_single = time.time()
for i in xrange(times):
    m.name
t_end_single = time.time()


t_start_multiple = time.time()
for i in xrange(times):
    m.ownedElement
t_end_multiple = time.time()

speed_single = t_end_single - t_start_single
speed_multiple = t_end_multiple - t_start_multiple

factor = speed_single / speed_multiple

print "SINGLE:", speed_single
print "MULTIPLE:", speed_multiple

print
print "FACTOR", factor

# There's supposed to be a very small difference in execution speed
# In fact the speed should be same for both, but we obviously need
# some leeway.
assert factor < 1.10
assert factor > 0.90
