blob: 9caed0efc4a52ba6ead0d76f8425082639951702 [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
Dave Wallace8800f732023-08-31 00:47:44 -040015from asfframework import VppAsfTestCase
Paul Vinciguerra888640a2019-05-14 21:01:28 -040016import vpp_papi_provider
17
18F64_ONE = 1.0
19
20
Dave Wallace8800f732023-08-31 00:47:44 -040021class TestEndian(VppAsfTestCase):
Paul Vinciguerra888640a2019-05-14 21:01:28 -040022 """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 )