-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.py
More file actions
63 lines (45 loc) · 1.4 KB
/
test.py
File metadata and controls
63 lines (45 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import shutil, os, sys
if not os.path.exists("build"):
os.mkdir("build")
os.chdir("build")
if not os.path.exists("conanbuildinfo.cmake"):
os.system("conan install ../pythoncpp -s arch=x86 --build=missing")
os.system('cmake ../pythoncpp -G "Visual Studio 14"')
os.system('cmake --build . --config Release')
os.chdir("bin")
def my_log(msg):
print "\n MY MSG! ", msg
def run_module(m):
m.set_log_function(my_log)
print "\n*** RUNNING ", m.__name__, " ******"
print "Addition:", m.add(2, 3)
print "Multiply:", m.multiply(3, 5)
print "Default name ", m.Looney().getName()
pet = m.Looney()
pet.setName()
print "Default name ", pet.getName()
duffy = m.Looney("duffy")
print "Looney name ", duffy.getName()
duffy.setName("Duffy")
print "Looney name ", duffy.getName()
food = m.Food()
food.quantity = 1.2
duffy.give(food)
print "Happy ", duffy.happiness, " food ", food.quantity
water = m.Water()
water.amount = 2.3
duffy.give(water)
print "Happy ", duffy.happiness
silvester = m.Looney("Silvester")
print "Average happines ", m.average([duffy, silvester])
silvester.friends = ["Taz", "Bugs"]
duffy.friends = ["Elmer"]
print "Silvester friends ", silvester.friends
print "All friends ", m.collect([duffy, silvester])
def run():
sys.path.append(os.getcwd())
import boost_math
import pybind11_math
run_module(boost_math)
run_module(pybind11_math)
run()