Split out Rust BPF no-std stuff (#4968)

This commit is contained in:
Jack May
2019-07-08 20:28:05 -08:00
committed by GitHub
parent 49250f62aa
commit f9a2254688
35 changed files with 164 additions and 217 deletions

View File

@ -13,6 +13,7 @@ edition = "2018"
[dependencies]
solana-sdk-bpf-utils = { path = "../../../../sdk/bpf/rust/rust-utils", version = "0.17.0" }
solana-sdk-bpf-no-std = { path = "../../../../sdk/bpf/rust/rust-no-std", version = "0.17.0" }
[workspace]
members = []

View File

@ -4,12 +4,15 @@
#![allow(unreachable_code)]
#![allow(unused_attributes)]
#[cfg(not(test))]
extern crate solana_sdk_bpf_no_std;
extern crate solana_sdk_bpf_utils;
use solana_sdk_bpf_utils::entrypoint::*;
use solana_sdk_bpf_utils::log::*;
use solana_sdk_bpf_utils::{entrypoint, info};
#[derive(Debug, PartialEq)]
struct SStruct {
x: u64,
y: u64,
@ -59,3 +62,13 @@ fn process_instruction(ka: &mut [SolKeyedAccount], info: &SolClusterInfo, data:
info!("Success");
true
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_return_sstruct() {
assert_eq!(SStruct { x: 1, y: 2, z: 3 }, return_sstruct());
}
}