map gbp papi: match endianess of f64
[vpp.git] / test / test_endian.py
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
15 import framework
16 import vpp_papi_provider
17
18 F64_ONE = 1.0
19
20
21 class TestEndian(framework.VppTestCase):
22     """TestEndian"""
23
24     def test_f64_endian_value(self):
25         try:
26             rv = self.vapi.get_f64_endian_value(f64_one=F64_ONE)
27             self.assertEqual(rv.f64_one_result, F64_ONE,
28                              "client incorrectly deserializes f64 values.  "
29                              "Expected: %r. Received: %r." % (
30                                  F64_ONE, rv.f64_one_result))
31         except vpp_papi_provider.UnexpectedApiReturnValueError:
32             self.fail('client incorrectly serializes f64 values.')
33
34     def test_get_f64_increment_by_one(self):
35         expected = 43.0
36         rv = self.vapi.get_f64_increment_by_one(f64_value=42.0)
37         self.assertEqual(rv.f64_value, expected, 'Expected %r, received:%r.'
38                          % (expected, rv.f64_value))