Debian Codegraph @

tests/large_number.rs

raw symbols SCIP
1 use ronrust-analyzer cargo ron 0.12.0 crate/::valuerust-analyzer cargo ron 0.12.0 value/::{Numberrust-analyzer cargo ron 0.12.0 value/number/Number#, Valuerust-analyzer cargo ron 0.12.0 value/Value#};
2
3 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
4 fn test_large_numberrust-analyzer cargo ron 0.12.0 test_large_number().() {
5 let test_var = Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::newrust-analyzer cargo ron 0.12.0 value/number/impl#[Number]new().(10000000000000000000000.0f64));
6 let test_ser = ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::to_stringrust-analyzer cargo ron 0.12.0 ser/to_string().(&test_var).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
7 let test_deser = ronrust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<Valuerust-analyzer cargo ron 0.12.0 value/Value#>(&test_ser);
8
9 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
10 test_deser.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(),
11 Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::newrust-analyzer cargo ron 0.12.0 value/number/impl#[Number]new().(10000000000000000000000.0))
12 );
13 }
14
15 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
16 fn test_large_integer_to_floatrust-analyzer cargo ron 0.12.0 test_large_integer_to_float().() {
17 use ronrust-analyzer cargo ron 0.12.0 crate/::valuerust-analyzer cargo ron 0.12.0 value/::Numberrust-analyzer cargo ron 0.12.0 value/number/Number#;
18 let test_var = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::u64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u64/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u64/MAX. as u128 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add().1;
19 let test_ser = test_var.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
20 let test_deser = ronrust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<Valuerust-analyzer cargo ron 0.12.0 value/Value#>(&test_ser);
21
22 #[cfg(not(feature = "integer128"))]
23 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
24 test_deser.unwrap(),
25 Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F32rust-analyzer cargo ron 0.12.0 value/number/Number#F32#((test_var as f32).into())), // f64 representation matches f32
26 );
27 #[cfg(feature = "integer128")]
28 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(test_deser.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Valuerust-analyzer cargo ron 0.12.0 value/Value#::Numberrust-analyzer cargo ron 0.12.0 value/Value#Number#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U128rust-analyzer cargo ron 0.12.0 value/number/Number#U128#(test_var)),);
29 }