Patrik Gustavsson | c8a22f1 | 2020-11-18 17:05:50 +0100 | [diff] [blame] | 1 | # Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved. |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | # not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # Description: |
| 17 | # Contains unit tests for get API version for an external consumer |
Louis Verhaard | 11831ce | 2020-11-18 18:53:24 +0100 | [diff] [blame] | 18 | from ethosu.vela.api import API_VERSION |
| 19 | from ethosu.vela.api import npu_get_api_version |
Patrik Gustavsson | c8a22f1 | 2020-11-18 17:05:50 +0100 | [diff] [blame] | 20 | |
| 21 | |
Louis Verhaard | 11831ce | 2020-11-18 18:53:24 +0100 | [diff] [blame] | 22 | def test_npu_get_api_version(): |
| 23 | int_version = npu_get_api_version() |
Patrik Gustavsson | c8a22f1 | 2020-11-18 17:05:50 +0100 | [diff] [blame] | 24 | version_major = int_version >> 16 |
| 25 | version_minor = 0xFFFF & int_version |
Louis Verhaard | 11831ce | 2020-11-18 18:53:24 +0100 | [diff] [blame] | 26 | assert API_VERSION == f"{version_major}.{version_minor}" |