blob: bb54a03fd1365195a17d59f482aa3d380fa9a9bf [file] [log] [blame]
Paul Vinciguerra888640a2019-05-14 21:01:28 -04001# 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
15import framework
16import vpp_papi_provider
17
18F64_ONE = 1.0
19
20
21class 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)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020027 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 Vinciguerra888640a2019-05-14 21:01:28 -040033 except vpp_papi_provider.UnexpectedApiReturnValueError:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020034 self.fail("client incorrectly serializes f64 values.")
Paul Vinciguerra888640a2019-05-14 21:01:28 -040035
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 Sekerad9b0c6f2022-04-26 19:02:15 +020039 self.assertEqual(
40 rv.f64_value,
41 expected,
42 "Expected %r, received:%r." % (expected, rv.f64_value),
43 )