2019-06-12 13:04:53 -07:00
|
|
|
//! @brief Solana Rust-based BPF program utility functions and types
|
|
|
|
|
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
extern crate solana_sdk_bpf_utils;
|
|
|
|
|
2019-06-20 16:07:12 -07:00
|
|
|
use solana_sdk_bpf_utils::info;
|
2019-06-12 13:04:53 -07:00
|
|
|
|
|
|
|
pub fn many_args(
|
|
|
|
arg1: u64,
|
|
|
|
arg2: u64,
|
|
|
|
arg3: u64,
|
|
|
|
arg4: u64,
|
|
|
|
arg5: u64,
|
|
|
|
arg6: u64,
|
|
|
|
arg7: u64,
|
|
|
|
arg8: u64,
|
|
|
|
arg9: u64,
|
|
|
|
) -> u64 {
|
2019-07-08 22:24:57 -08:00
|
|
|
info!("Another package");
|
2019-06-20 16:07:12 -07:00
|
|
|
info!(arg1, arg2, arg3, arg4, arg5);
|
|
|
|
info!(arg6, arg7, arg8, arg9, 0);
|
2019-06-12 13:04:53 -07:00
|
|
|
arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9
|
|
|
|
}
|
2019-07-08 20:28:05 -08:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
extern crate std;
|
|
|
|
use super::*;
|
|
|
|
|
2019-07-08 22:24:57 -08:00
|
|
|
#[test]
|
|
|
|
fn pull_in_externs() {
|
|
|
|
// Rust on Linux excludes the solana_sdk_bpf_test library unless there is a
|
|
|
|
// direct dependency, use this test to force the pull in of the library.
|
|
|
|
// This is not necessary on macos and unfortunate on Linux
|
|
|
|
// Issue #4972
|
|
|
|
extern crate solana_sdk_bpf_test;
|
|
|
|
use solana_sdk_bpf_test::*;
|
|
|
|
unsafe { sol_log_("X".as_ptr(), 1) };
|
|
|
|
sol_log_64_(1, 2, 3, 4, 5);
|
2019-07-08 20:28:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_many_args() {
|
|
|
|
assert_eq!(45, many_args(1, 2, 3, 4, 5, 6, 7, 8, 9));
|
|
|
|
}
|
|
|
|
}
|