xref: /aosp_15_r20/external/cronet/build/rust/tests/test_rust_unittests/main.rs (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #![feature(test)]
6 extern crate test;
7 
8 chromium::import! {
9     "//build/rust/tests/test_rust_static_library";
10 }
11 
12 use test::Bencher;
13 use test_rust_static_library::add_two_ints_via_rust;
14 
15 #[test]
test_call_into_mixed_static_library()16 fn test_call_into_mixed_static_library() {
17     assert_eq!(add_two_ints_via_rust(5, 7), 12)
18 }
19 
20 #[allow(soft_unstable)]
21 #[bench]
test_benchmark(b: &mut Bencher)22 fn test_benchmark(b: &mut Bencher) {
23     b.iter(|| 2 + 2);
24 }
25