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

M = coral.loadModel("carpark.xml")
assert M

# XMI 2

coral.saveModel("tmp/outCarpark.xml", M, "2.0")
os.system("cp tmp/outCarpark.xml tmp/outCarpark2.xml")
M2 = coral.loadModel("tmp/outCarpark2.xml")
assert M2 

assert coral.isSameModel(M, M2)

print "OK"

# XMI 1
       
coral.saveModel("tmp/outCarpark3.xml", M2, "1.2")
os.system("cp tmp/outCarpark3.xml tmp/outCarpark4.xml")

M3 = coral.loadModel("tmp/outCarpark4.xml")

assert coral.isSameModel(M, M3)
assert coral.isSameModel(M2, M3)

assert coral.isSameModel(M3, M)
assert coral.isSameModel(M3, M2)

