-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(testkit): provide proptest 's arbitraies to generate samples
Signed-off-by: David Bernard <david.bernard.31@gmail.com>
- Loading branch information
Showing
48 changed files
with
979 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "change",)] | ||
pub change: ContentChange, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct ContentChange { | ||
#[serde(rename = "id",)] | ||
pub id: String, | ||
#[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] | ||
pub source: Option<crate::UriReference>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "signature",)] | ||
pub signature: String, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] | ||
pub repository: Option<ContentRepository>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct ContentRepository { | ||
#[serde(rename = "id",)] | ||
pub id: String, | ||
#[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] | ||
pub source: Option<crate::UriReference>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] | ||
pub repository: Option<ContentRepository>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct ContentRepository { | ||
#[serde(rename = "id",)] | ||
pub id: String, | ||
#[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] | ||
pub source: Option<crate::UriReference>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none",)] | ||
pub artifact_id: Option<String>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
// @generated | ||
// by cdevents/sdk-rust/generator (subject.hbs) | ||
|
||
#[cfg(feature = "testkit")] use proptest_derive::Arbitrary; | ||
use serde::{Serialize, Deserialize}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct Content { | ||
#[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] | ||
pub repository: Option<ContentRepository>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "testkit", derive(Arbitrary))] | ||
#[serde(deny_unknown_fields)] | ||
pub struct ContentRepository { | ||
#[serde(rename = "id",)] | ||
pub id: String, | ||
#[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] | ||
pub source: Option<crate::UriReference>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use proptest::prelude::*; | ||
use super::*; | ||
|
||
proptest! { | ||
#[test] | ||
#[cfg(feature = "testkit")] | ||
fn arbitraries_are_json_valid(s in any::<Content>()) { | ||
let json_str = serde_json::to_string(&s).unwrap(); | ||
let actual = serde_json::from_str::<Content>(&json_str).unwrap(); | ||
assert_eq!(s, actual); | ||
} | ||
} | ||
} |
Oops, something went wrong.