Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 3 | import sys |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | from example import Sequence |
| 7 | |
| 8 | s = Sequence(5) |
| 9 | print("s = " + str(s)) |
| 10 | print("len(s) = " + str(len(s))) |
| 11 | print("s[0], s[3] = %f %f" % (s[0], s[3])) |
| 12 | print('12.34 in s: ' + str(12.34 in s)) |
| 13 | s[0], s[3] = 12.34, 56.78 |
| 14 | print('12.34 in s: ' + str(12.34 in s)) |
| 15 | print("s[0], s[3] = %f %f" % (s[0], s[3])) |
| 16 | rev = reversed(s) |
| 17 | rev2 = s[::-1] |
| 18 | print("rev[0], rev[1], rev[2], rev[3], rev[4] = %f %f %f %f %f" % (rev[0], rev[1], rev[2], rev[3], rev[4])) |
| 19 | |
| 20 | for i in rev: |
| 21 | print(i, end=' ') |
| 22 | print('') |
| 23 | for i in rev2: |
| 24 | print(i, end=' ') |
| 25 | print('') |
| 26 | print(rev == rev2) |
| 27 | rev[0::2] = Sequence([2.0, 2.0, 2.0]) |
| 28 | for i in rev: |
| 29 | print(i, end=' ') |
| 30 | print('') |
Jason Rhinelander | 3f58937 | 2016-08-07 13:05:26 -0400 | [diff] [blame] | 31 | |
| 32 | from example import ConstructorStats |
| 33 | cstats = ConstructorStats.get(Sequence) |
| 34 | print("Instances not destroyed:", cstats.alive()) |
| 35 | s = None |
| 36 | print("Instances not destroyed:", cstats.alive()) |
| 37 | rev = None |
| 38 | print("Instances not destroyed:", cstats.alive()) |
| 39 | rev2 = None |
| 40 | print("Instances not destroyed:", cstats.alive()) |
| 41 | print("Constructor values:", cstats.values()) |
| 42 | print("Default constructions:", cstats.default_constructions) |
| 43 | print("Copy constructions:", cstats.copy_constructions) |
| 44 | print("Move constructions:", cstats.move_constructions >= 1) |
| 45 | print("Copy assignments:", cstats.copy_assignments) |
| 46 | print("Move assignments:", cstats.move_assignments) |