Paul Vinciguerra | 888640a | 2019-05-14 21:01:28 -0400 | [diff] [blame] | 1 | # Copyright (c) 2019. Vinci Consulting Corp. All Rights Reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 15 | from asfframework import VppAsfTestCase |
Paul Vinciguerra | 888640a | 2019-05-14 21:01:28 -0400 | [diff] [blame] | 16 | import vpp_papi_provider |
| 17 | |
| 18 | F64_ONE = 1.0 |
| 19 | |
| 20 | |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 21 | class TestEndian(VppAsfTestCase): |
Paul Vinciguerra | 888640a | 2019-05-14 21:01:28 -0400 | [diff] [blame] | 22 | """TestEndian""" |
| 23 | |
| 24 | def test_f64_endian_value(self): |
| 25 | try: |
| 26 | rv = self.vapi.get_f64_endian_value(f64_one=F64_ONE) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 27 | self.assertEqual( |
| 28 | rv.f64_one_result, |
| 29 | F64_ONE, |
| 30 | "client incorrectly deserializes f64 values. " |
| 31 | "Expected: %r. Received: %r." % (F64_ONE, rv.f64_one_result), |
| 32 | ) |
Paul Vinciguerra | 888640a | 2019-05-14 21:01:28 -0400 | [diff] [blame] | 33 | except vpp_papi_provider.UnexpectedApiReturnValueError: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 34 | self.fail("client incorrectly serializes f64 values.") |
Paul Vinciguerra | 888640a | 2019-05-14 21:01:28 -0400 | [diff] [blame] | 35 | |
| 36 | def test_get_f64_increment_by_one(self): |
| 37 | expected = 43.0 |
| 38 | rv = self.vapi.get_f64_increment_by_one(f64_value=42.0) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 39 | self.assertEqual( |
| 40 | rv.f64_value, |
| 41 | expected, |
| 42 | "Expected %r, received:%r." % (expected, rv.f64_value), |
| 43 | ) |