1// Translated from C to Rust. The original C code can be found at
2// https://github.com/ulfjack/ryu and carries the following license:
3//
4// Copyright 2018 Ulf Adams
5//
6// The contents of this file may be used under the terms of the Apache License,
7// Version 2.0.
8//
9// (See accompanying file LICENSE-Apache or copy at
10// http://www.apache.org/licenses/LICENSE-2.0)
11//
12// Alternatively, the contents of this file may be used under the terms of
13// the Boost Software License, Version 1.0.
14// (See accompanying file LICENSE-Boost or copy at
15// https://www.boost.org/LICENSE_1_0.txt)
16//
17// Unless required by applicable law or agreed to in writing, this software
18// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19// KIND, either express or implied.
20
21#![allow(dead_code)]
22#![allow(
23 clippy::cast_lossless,
24 clippy::cast_possible_truncation,
25 clippy::cast_possible_wrap,
26 clippy::cast_sign_loss,
27 clippy::unreadable_literal,
28 clippy::unseparated_literal_suffix,
29 clippy::wildcard_imports
30)]
31
32#[path = "../src/common.rs"]
33mod common;
34
35#[path = "../src/d2s_full_table.rs"]
36mod d2s_full_table;
37
38#[path = "../src/d2s_intrinsics.rs"]
39mod d2s_intrinsics;
40
41#[path = "../src/d2s_small_table.rs"]
42mod d2s_small_table;
43
44use d2s_full_table::*;
45use d2s_small_table::*;
46
47#[test]
48fn test_compute_pow5() {
49 for (i, entry) in DOUBLE_POW5_SPLIT.iter().enumerate() {
50 assert_eq!(*entry, unsafe { compute_pow5(i as u32) }, "entry {}", i);
51 }
52}
53
54#[test]
55fn test_compute_inv_pow5() {
56 for (i, entry) in DOUBLE_POW5_INV_SPLIT[..292].iter().enumerate() {
57 assert_eq!(*entry, unsafe { compute_inv_pow5(i as u32) }, "entry {}", i);
58 }
59}
60