| 1 |
################################################################################ |
| 2 |
# |
| 3 |
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. |
| 4 |
# |
| 5 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 |
# of this software and associated documentation files (the "Software"), to deal |
| 7 |
# in the Software without restriction, including without limitation the rights |
| 8 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell cop- |
| 9 |
# ies of the Software, and to permit persons to whom the Software is furnished |
| 10 |
# to do so, subject to the following conditions: |
| 11 |
# |
| 12 |
# The above copyright notice and this permission notice shall be included in all |
| 13 |
# copies or substantial portions of the Software. |
| 14 |
# |
| 15 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IM- |
| 16 |
# PLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 17 |
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 18 |
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 19 |
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNE- |
| 20 |
# CTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
################################################################################ |
| 22 |
|
| 23 |
import rocisa |
| 24 |
from copy import deepcopy |
| 25 |
import pickle |
| 26 |
|
| 27 |
name = "Test" |
| 28 |
|
| 29 |
def test_label(): |
| 30 |
lm = rocisa.label.LabelManager() |
| 31 |
# Basic |
| 32 |
lm.addName(name) |
| 33 |
print("Get name:", lm.getName(name)) |
| 34 |
print("Get name inc:", lm.getNameInc(name)) |
| 35 |
print("Get name with index:", lm.getNameIndex(name, 0)) |
| 36 |
print("Get unique name:", lm.getUniqueName()) |
| 37 |
print("Get unique name with prefix:", lm.getUniqueNamePrefix("Yeee")) |
| 38 |
|
| 39 |
def test_label_copy(): |
| 40 |
lm = rocisa.label.LabelManager() |
| 41 |
lm2 = deepcopy(lm) |
| 42 |
print("Copied lm using deepcopy:", lm2.getName(name)) |
| 43 |
lm3 = pickle.loads(pickle.dumps(lm)) |
| 44 |
print("Copied lm using pickle:", lm3.getName(name)) |