import os
import sys
import math
import random

path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
sys.path.insert(0, path)

from msl.loadlib import (
    IS_PYTHON_64BIT,
    LoadLibrary,
)

bitness = 'x64' if IS_PYTHON_64BIT else 'x86'
filename = 'legacy_v2_runtime_{}.dll'.format(bitness)
path = os.path.abspath(os.path.join(os.path.dirname(__file__), filename))

# this is not necessary, just wanted to randomly select
# one of the supported .NET libtype's
libtype = 'clr' if random.random() > 0.5 else 'net'

net = LoadLibrary(path, libtype)

if net.lib.SpelNetLib.SpelAxis.X != 1:
    sys.exit('net.lib.SpelNetLib.SpelAxis.X != 1')

atan = net.lib.SpelNetLib.Spel().Atan(1e9)
if abs(math.pi / 2.0 - atan) > 1e-6:
    sys.exit('Atan: {} != Pi/2'.format(atan))

print('SUCCESS')

import os
import sys
import random

path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
sys.path.insert(0, path)

from msl.loadlib import (
    IS_PYTHON_64BIT,
    LoadLibrary,
)

bitness = 'x64' if IS_PYTHON_64BIT else 'x86'
filename = 'legacy_v2_runtime_{}.dll'.format(bitness)
path = os.path.abspath(os.path.join(os.path.dirname(__file__), filename))

# this is not necessary, just wanted to randomly select
# one of the supported .NET libtype's
libtype = 'clr' if random.random() > 0.5 else 'net'

net = LoadLibrary(path, libtype)

if net.lib.SpelNetLib.SpelAxis.X != 1:
    sys.exit('SpelAxis.X != 1')

print('SUCCESS')

remove the Spel().Atan() call since this raises DLL dependency issues