Skip to content

Commit

Permalink
Restore README, add license and make the test more random
Browse files Browse the repository at this point in the history
  • Loading branch information
ppamorim committed Feb 6, 2022
1 parent 86a77f2 commit af3415a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions compatibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ We have created a test project that can be used to test the compatibility betwee
## Adding a test case for your project

To add a test case for your project, please follow the following steps:
- [X] Fork https://github.com/bincode-org/bincode
- [X] create a new file `compatibility/src/<name>.rs`.
- [X] Add a link to your project: https://github.com/ppamorim/openraft/tree/bincode-bug/example-raft-kv
- [X] Add `Licence: MIT OR Apache-2.0` if you agree to distribute your code under this license
- [X] Add a `mod <name>;` in the `lib.rs`. Make sure it's alphabetically ordered (check the ordering in your file system).
- [X] Add your structs.
- [ ] Fork https://github.com/bincode-org/bincode
- [ ] create a new file `compatibility/src/<name>.rs`.
- [ ] Add a link to your project
- [ ] Add `Licence: MIT OR Apache-2.0` if you agree to distribute your code under this license
- [ ] Add a `mod <name>;` in the `lib.rs`. Make sure it's alphabetically ordered (check the ordering in your file system).
- [ ] Add your structs.
- Adding references to libraries is not recommended. Libraries will not be implementing `bincode 2`'s encoding/decoding system.
- If you need references to libraries, consider adding a test case for that library, and then referencing that test.
- [X] Make sure structs derive the following traits:
- [X] `serde::Serialize` and `serde::Deserialize`, like normal
- [X] `bincode_2::Encode` and `bincode_2::Decode`, for the bincode 2 encode/decode mechanic
- [X] Because the crate is renamed to `bincode_2`, you also need to add `#[bincode(crate = "bincode_2")]`
- [X] `Debug, PartialEq`
- [ ] Make sure structs derive the following traits:
- [ ] `serde::Serialize` and `serde::Deserialize`, like normal
- [ ] `bincode_2::Encode` and `bincode_2::Decode`, for the bincode 2 encode/decode mechanic
- [ ] Because the crate is renamed to `bincode_2`, you also need to add `#[bincode(crate = "bincode_2")]`
- [ ] `Debug, PartialEq`

```rs
#[derive(Serialize, Deserialize, bincode_2::Encode, bincode_2::Decode, Debug, PartialEq)]
Expand All @@ -30,9 +30,9 @@ pub struct YourStruct {
}
```

- [X] Use `rand` to be able to generate a random test case for your project.
- [X] For strings there is a helper function in `crate`: `gen_string(rng: &mut impl Rng) -> String`
- [X] Add the following code:
- [ ] Use `rand` to be able to generate a random test case for your project.
- [ ] For strings there is a helper function in `crate`: `gen_string(rng: &mut impl Rng) -> String`
- [ ] Add the following code:

```rs
#[test]
Expand Down
2 changes: 1 addition & 1 deletion compatibility/src/membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn test() {
}

fn vec_random_btreeset(rng: &mut ThreadRng) -> Vec<BTreeSet<NodeId>> {
let mut vec = Vec::with_capacity(5);
let mut vec = Vec::with_capacity(10);
for _ in 0..rng.gen_range(0..10) {
vec.push(random_btreeset(rng));
}
Expand Down

0 comments on commit af3415a

Please sign in to comment.