#![allow(missing_docs)]
use crate::hash_type;
use crate::ActionHash;
use crate::ActionHashB64;
use crate::AgentPubKey;
use crate::AgentPubKeyB64;
use crate::AnyDhtHash;
use crate::AnyDhtHashB64;
use crate::AnyLinkableHash;
use crate::AnyLinkableHashB64;
use crate::DhtOpHash;
use crate::DhtOpHashB64;
use crate::DnaHash;
use crate::DnaHashB64;
use crate::EntryHash;
use crate::EntryHashB64;
use crate::ExternalHash;
use crate::ExternalHashB64;
use crate::WasmHash;
use crate::WasmHashB64;
use ::fixt::prelude::*;
use std::convert::TryFrom;
pub type HashTypeEntry = hash_type::Entry;
pub type HashTypeAnyDht = hash_type::AnyDht;
pub type HashTypeAnyLinkable = hash_type::AnyLinkable;
fixturator!(
HashTypeAnyDht;
curve Empty HashTypeAnyDht::Action;
curve Unpredictable HashTypeAnyDht::Action;
curve Predictable HashTypeAnyDht::Action;
);
fixturator!(
HashTypeAnyLinkable;
curve Empty HashTypeAnyLinkable::External;
curve Unpredictable HashTypeAnyLinkable::Action;
curve Predictable HashTypeAnyLinkable::Entry;
);
pub type ThirtyTwoHashBytes = Vec<u8>;
fixturator!(
ThirtyTwoHashBytes,
[0; 32].to_vec(),
{
let mut u8_fixturator = U8Fixturator::new(Unpredictable);
let mut bytes = vec![];
for _ in 0..32 {
bytes.push(u8_fixturator.next().unwrap());
}
bytes
},
{
let mut index = get_fixt_index!();
let mut u8_fixturator = U8Fixturator::new_indexed(Predictable, index);
let mut bytes = vec![];
for _ in 0..32 {
bytes.push(u8_fixturator.next().unwrap());
}
index += 1;
set_fixt_index!(index);
bytes
}
);
fixturator!(
with_vec 0 5;
AgentPubKey;
curve Empty AgentPubKey::from_raw_32(ThirtyTwoHashBytesFixturator::new_indexed(Empty, get_fixt_index!()).next().unwrap());
curve Unpredictable AgentPubKey::from_raw_32(ThirtyTwoHashBytesFixturator::new_indexed(Unpredictable, get_fixt_index!()).next().unwrap());
curve Predictable {
let agents = [
AgentPubKey::try_from("uhCAkJCuynkgVdMn_bzZ2ZYaVfygkn0WCuzfFspczxFnZM1QAyXoo")
.unwrap(),
AgentPubKey::try_from("uhCAk39SDf7rynCg5bYgzroGaOJKGKrloI1o57Xao6S-U5KNZ0dUH")
.unwrap(),
];
agents[get_fixt_index!() % agents.len()].clone()
};
);
fixturator!(
AgentPubKeyB64;
constructor fn new(AgentPubKey);
);
fixturator!(
EntryHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
EntryHashB64;
constructor fn new(EntryHash);
);
fixturator!(
DnaHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
DnaHashB64;
constructor fn new(DnaHash);
);
fixturator!(
DhtOpHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
DhtOpHashB64;
constructor fn new(DhtOpHash);
);
fixturator!(
with_vec 0 5;
ActionHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
ActionHashB64;
constructor fn new(ActionHash);
);
fixturator!(
WasmHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
WasmHashB64;
constructor fn new(WasmHash);
);
fixturator!(
AnyDhtHash;
constructor fn from_raw_32_and_type(ThirtyTwoHashBytes, HashTypeAnyDht);
);
fixturator!(
AnyDhtHashB64;
constructor fn new(AnyDhtHash);
);
fixturator!(
AnyLinkableHash;
constructor fn from_raw_32_and_type(ThirtyTwoHashBytes, HashTypeAnyLinkable);
);
fixturator!(
AnyLinkableHashB64;
constructor fn new(AnyLinkableHash);
);
fixturator!(
ExternalHash;
constructor fn from_raw_32(ThirtyTwoHashBytes);
);
fixturator!(
ExternalHashB64;
constructor fn new(ExternalHash);
);