Skip to content

Commit

Permalink
Make sure unit and doc-tests use rusp_lib instead of rusp
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Egger <[email protected]>
  • Loading branch information
therealprof committed Nov 15, 2024
1 parent 37261da commit e1ed8c9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 42 deletions.
42 changes: 21 additions & 21 deletions rusp-lib/src/usp_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::usp_record::{NoSessionContextRecord, Record, SessionContextRecord};
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let record =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x23, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3a, 0x3a,
Expand Down Expand Up @@ -45,7 +45,7 @@ pub fn try_decode_record(bytes: &[u8]) -> Result<Record> {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -78,7 +78,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp::Msg;
/// use rusp_lib::usp::Msg;
/// let msg =
/// Msg::from_bytes(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -154,7 +154,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -187,7 +187,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -202,7 +202,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -231,7 +231,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -246,7 +246,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -283,7 +283,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -298,7 +298,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand Down Expand Up @@ -331,7 +331,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -346,7 +346,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand All @@ -363,7 +363,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x05, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x12,
Expand All @@ -387,7 +387,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -402,7 +402,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
Expand All @@ -419,7 +419,7 @@ impl Msg {
/// ```
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x05, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x12,
Expand Down Expand Up @@ -448,7 +448,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x09, 0x0a, 0x07, 0x6e, 0x6f, 0x2d, 0x62,
Expand Down Expand Up @@ -511,7 +511,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_record::Record;
/// use rusp_lib::usp_record::Record;
/// let record =
/// Record::from_bytes(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand Down Expand Up @@ -540,7 +540,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let no_session_empty_payload =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand Down
28 changes: 14 additions & 14 deletions rusp-lib/src/usp_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use anyhow::{Context, Result};
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp::usp_encoder::try_encode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// use rusp_lib::usp_encoder::try_encode_record;
/// let bytes = &[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
/// 0x6f, 0x63, 0x3a, 0x3a, 0x74, 0x6f, 0x1a, 0x09,
Expand All @@ -37,8 +37,8 @@ pub fn try_encode_record(record: &Record) -> Result<Vec<u8>> {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp::usp_encoder::try_encode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_encoder::try_encode_msg;
/// let bytes = &[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
/// 0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
Expand Down Expand Up @@ -89,7 +89,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let record =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand All @@ -113,7 +113,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let record =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand All @@ -137,7 +137,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let bytes = &[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
/// 0x6f, 0x63, 0x3a, 0x3a, 0x74, 0x6f, 0x1a, 0x09,
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let record =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand Down Expand Up @@ -216,7 +216,7 @@ impl Record {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_record;
/// use rusp_lib::usp_decoder::try_decode_record;
/// let record =
/// try_decode_record(&[
/// 0x0a, 0x03, 0x31, 0x2e, 0x33, 0x12, 0x07, 0x64,
Expand Down Expand Up @@ -284,7 +284,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -310,7 +310,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let msg =
/// try_decode_msg(&[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
Expand All @@ -336,7 +336,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let bytes = &[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
/// 0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
Expand Down Expand Up @@ -369,7 +369,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let bytes = &[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
/// 0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
Expand Down Expand Up @@ -419,7 +419,7 @@ impl Msg {
/// # Example
///
/// ```
/// use rusp::usp_decoder::try_decode_msg;
/// use rusp_lib::usp_decoder::try_decode_msg;
/// let bytes = &[
/// 0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
/// 0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
Expand Down
12 changes: 6 additions & 6 deletions rusp-lib/tests/parsing_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod tests {
use quick_protobuf::{BytesReader, MessageRead};
use rusp::usp::{mod_Body::OneOfmsg_body::request, Msg};
use rusp::usp_record::{mod_Record::OneOfrecord_type::no_session_context, Record};
use rusp_lib::usp::{mod_Body::OneOfmsg_body::request, Msg};
use rusp_lib::usp_record::{mod_Record::OneOfrecord_type::no_session_context, Record};

#[test]
fn simple_notify() {
Expand All @@ -17,7 +17,7 @@ mod tests {
0x6d, 0x62, 0x65, 0x72, 0x22, 0x03, 0x31, 0x2e, 0x30,
];

use rusp::usp::{
use rusp_lib::usp::{
mod_Header::MsgType::NOTIFY, mod_Notify::OneOfnotification::on_board_req,
mod_Request::OneOfreq_type::notify,
};
Expand Down Expand Up @@ -80,7 +80,7 @@ mod tests {
0x73, 0x74, 0x18, 0x01,
];

use rusp::usp::{mod_Header::MsgType::ADD, mod_Request::OneOfreq_type::add};
use rusp_lib::usp::{mod_Header::MsgType::ADD, mod_Request::OneOfreq_type::add};

let mut reader = BytesReader::from_bytes(&bytes);
let record = Record::from_reader(&mut reader, &bytes).expect("Cannot read Record");
Expand Down Expand Up @@ -144,7 +144,7 @@ mod tests {
0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
];

use rusp::usp::{mod_Header::MsgType::DELETE, mod_Request::OneOfreq_type::delete};
use rusp_lib::usp::{mod_Header::MsgType::DELETE, mod_Request::OneOfreq_type::delete};

let mut reader = BytesReader::from_bytes(&bytes);
let record = Record::from_reader(&mut reader, &bytes).expect("Cannot read Record");
Expand Down Expand Up @@ -197,7 +197,7 @@ mod tests {
0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
];

use rusp::usp::{mod_Header::MsgType::GET, mod_Request::OneOfreq_type::get};
use rusp_lib::usp::{mod_Header::MsgType::GET, mod_Request::OneOfreq_type::get};

let mut reader = BytesReader::from_bytes(&bytes);
let record = Record::from_reader(&mut reader, &bytes).expect("Cannot read Record");
Expand Down
2 changes: 1 addition & 1 deletion rusp-lib/tests/test_json.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod tests {
use quick_protobuf::{BytesReader, MessageRead};
use rusp::usp_record::Record;
use rusp_lib::usp_record::Record;

#[test]
fn simple_notify() {
Expand Down

0 comments on commit e1ed8c9

Please sign in to comment.