• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 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 
main()5 fn main() {
6     println!("Hello world!");
7     println!("AddViaCc(100,42) = {}", ::self_contained_target_rs_api::AddViaCc(100, 42));
8     println!("MultiplyViaCc(100,42) = {}", ::self_contained_target_rs_api::MultiplyViaCc(100, 42));
9 }
10 
11 #[cfg(test)]
12 mod tests {
13     #[test]
test_self_contained_target_function_call_basics()14     fn test_self_contained_target_function_call_basics() {
15         assert_eq!(100 + 42, ::self_contained_target_rs_api::AddViaCc(100, 42));
16         assert_eq!(100 * 42, ::self_contained_target_rs_api::MultiplyViaCc(100, 42));
17     }
18 
19     #[test]
test_self_contained_target_pod_struct_basics()20     fn test_self_contained_target_pod_struct_basics() {
21         let x = ::self_contained_target_rs_api::CcPodStruct { value: 123 };
22         assert_eq!(x.value, 123);
23     }
24 
25     #[test]
test_target_depending_on_another()26     fn test_target_depending_on_another() {
27         ctor::emplace! {
28             let x = ::target_depending_on_another_rs_api::CreateCcPodStructFromValue(456);
29         }
30         assert_eq!(x.value, 456);
31     }
32 }
33