Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No std #151

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
aa9a83b
Use no_std branch of cbor_event
SimonIT Mar 3, 2023
351165b
Set no_std flag for rust project
SimonIT Mar 3, 2023
9f6e20a
Begin adapting cbor_event no_std changes and replace std with core
SimonIT Mar 3, 2023
4d8af30
Re-add accidentally removed |
SimonIT Mar 3, 2023
aca9718
More std to core transformation
SimonIT Mar 4, 2023
08fafe2
More adaption
SimonIT Mar 4, 2023
13f0bc0
remove blocking generic
connectety Mar 4, 2023
a0c2db7
Remove lib from cargo toml to not have to specify a global memory all…
SimonIT Mar 4, 2023
8380d6d
It's alloc::collections not core
SimonIT Mar 8, 2023
a39aea8
Add Vec import to cbor_encondings
SimonIT Mar 8, 2023
78a4a4b
Convert std min to core min
SimonIT Mar 8, 2023
141dc6e
Move print_cbor_types to tests
SimonIT Mar 13, 2023
ac50a90
Add more alloc imports
SimonIT Mar 13, 2023
8fb4c9c
Use to_string for Error Result
SimonIT Mar 19, 2023
7cb437e
Fix hash_map and wasm imports
SimonIT Mar 19, 2023
269f47c
Fix some test compilation with print_cbor_types
SimonIT Mar 23, 2023
2bf61d3
Introduce feature std for JsonSchema, Derivative
SimonIT Mar 29, 2023
e2d79e3
Fix deser_test
SimonIT Mar 29, 2023
7db794a
Fix some borrowing in tests with cloning
SimonIT Mar 30, 2023
2b2126f
Merge remote-tracking branch 'upstream/master' into no_std
connectety Mar 31, 2023
4aee0c1
Use cfg_attr branch of codegen
SimonIT Apr 2, 2023
ed45d39
Merge branch 'master' into no_std
SimonIT Apr 7, 2023
1e2ce8f
Make clippy happy
SimonIT Apr 22, 2023
58b3237
Merge remote-tracking branch 'upstream/master' into no_std
SimonIT Apr 22, 2023
c2db634
Change codegen to dcSpark master
SimonIT Apr 23, 2023
0de6ef4
Merge remote-tracking branch 'upstream/master' into no_std
SimonIT Apr 25, 2023
feefef2
Fix test split for core test
SimonIT Apr 25, 2023
60d0595
Merge branch 'master' into no_std
SimonIT Apr 26, 2023
5720e72
Merge remote-tracking branch 'upstream/master' into no_std
SimonIT Mar 7, 2024
3982e63
Adapt changes to no_std
SimonIT Mar 7, 2024
2cc7fb0
Clippy
SimonIT Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ default = ["which-rustfmt"]
which-rustfmt = ["which"]

[dependencies]
cbor_event = "2.4.0"
cbor_event = { git = "https://github.com/primetype/cbor_event" }
cddl = "0.9.1"
clap = { version = "4.3.12", features = ["derive"] }
codegen = { git = "https://github.com/dcSpark/codegen", branch = "master" }
Expand All @@ -22,4 +22,4 @@ nom = "7.1.1"
pathdiff = "0.2.1"
which = { version = "4.4.0", optional = true, default-features = false }
syn = "2.0.16"
quote = "1.0.31"
quote = "1.0.31"
43 changes: 30 additions & 13 deletions example/serialization_unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ mod tests {
use super::*;
use serialization::*;

fn print_cbor_types(obj_name: &str, vec: &Vec<u8>) {
use cbor_event::Type;
let mut raw = Deserializer::from(std::io::Cursor::new(vec));
fn print_cbor_types(obj_name: &str, vec: Vec<u8>) {
use cbor_event::Type;
let mut raw = Deserializer::from(vec);
println!("{} = {{", obj_name);
loop {
match raw.cbor_type() {
Expand All @@ -24,9 +24,9 @@ mod tests {
}

fn deser_test<T: Deserialize + ToBytes>(orig: T) {
print_cbor_types("orig", &orig.to_bytes());
let deser = T::deserialize(&mut Deserializer::from(std::io::Cursor::new(orig.to_bytes()))).unwrap();
print_cbor_types("deser", &deser.to_bytes());
print_cbor_types("orig", orig.to_bytes());
let deser = T::deserialize(&mut Deserializer::from(orig.to_bytes())).unwrap();
print_cbor_types("deser", deser.to_bytes());
assert_eq!(orig.to_bytes(), deser.to_bytes());
}

Expand All @@ -37,7 +37,10 @@ mod tests {

#[test]
fn foo2_some() {
deser_test(Foo2::new(143546, Some(TaggedText::new(String::from("afdjfkjsiefefe")))));
deser_test(Foo2::new(
143546,
Some(TaggedText::new(String::from("afdjfkjsiefefe"))),
));
}

#[test]
Expand All @@ -47,17 +50,26 @@ mod tests {

#[test]
fn bar() {
deser_test(Bar::new(&Foo::new(436, String::from("jfkdf"), vec![6, 4]), None));
deser_test(Bar::new(
&Foo::new(436, String::from("jfkdf"), vec![6, 4]),
None,
));
}

#[test]
fn plain() {
deser_test(Plain::new(7576, &TaggedText::new(String::from("wiorurri34h"))));
deser_test(Plain::new(
7576,
&TaggedText::new(String::from("wiorurri34h")),
));
}

#[test]
fn outer() {
deser_test(Outer::new(2143254, &Plain::new(7576, &TaggedText::new(String::from("wiorurri34h")))));
deser_test(Outer::new(
2143254,
&Plain::new(7576, &TaggedText::new(String::from("wiorurri34h"))),
));
}

#[test]
Expand Down Expand Up @@ -89,15 +101,17 @@ mod tests {
fn type_choice_hello_world() {
deser_test(TypeChoice::new_helloworld());
}

#[test]
fn type_choice_uint() {
deser_test(TypeChoice::new_u64(53435364));
}

#[test]
fn type_choice_text() {
deser_test(TypeChoice::new_text(String::from("jdfidsf83j3 jkrjefdfk !!")));
deser_test(TypeChoice::new_text(String::from(
"jdfidsf83j3 jkrjefdfk !!",
)));
}

#[test]
Expand All @@ -122,6 +136,9 @@ mod tests {

#[test]
fn group_choice_plain() {
deser_test(GroupChoice::new_plain(&Plain::new(354545, &TaggedText::new(String::from("fdsfdsfdg")))));
deser_test(GroupChoice::new_plain(&Plain::new(
354545,
&TaggedText::new(String::from("fdsfdsfdg")),
)));
}
}
Loading
Loading