Poly2Block; Block2Poly; SEA128 tasks working #2
3 changed files with 3 additions and 21 deletions
|
|
@ -8,7 +8,6 @@ use serde_json::Value;
|
|||
pub fn block2poly(val: &Value) -> Result<Vec<u8>> {
|
||||
// Convert JSON data in to a u128
|
||||
// TODO: Transfer decoding into own function?
|
||||
eprintln!("Decoded is: {:?}", val["block"]);
|
||||
let string: String = serde_json::from_value(val["block"].clone())?;
|
||||
let decoded: Vec<u8> = BASE64_STANDARD.decode(string)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,25 +24,6 @@ pub fn parse_json(json: String) -> Result<Testcases> {
|
|||
Ok(deserialised)
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn generate_response_payload(
|
||||
testcase_id: String,
|
||||
payload: Value,
|
||||
) -> Result<HashMap<String, Value>> {
|
||||
let mut hashmap = HashMap::new();
|
||||
hashmap.insert(testcase_id, payload);
|
||||
Ok(hashmap)
|
||||
}
|
||||
|
||||
pub fn generate_response(payloads: HashMap<String, Value>) -> Result<Value> {
|
||||
let response: Responses = Responses {
|
||||
responses: payloads,
|
||||
};
|
||||
|
||||
Ok(serde_json::to_value(response).unwrap())
|
||||
}
|
||||
*/
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fs;
|
||||
|
|
@ -104,6 +85,8 @@ mod tests {
|
|||
testcase_1.action
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Reactivate tests
|
||||
/*
|
||||
#[test]
|
||||
fn test_response_payload_generation() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn get_coefficients(num: u128) -> Vec<u8> {
|
|||
for shift in 0..128 {
|
||||
//println!("{:?}", ((num >> shift) & 1));
|
||||
if ((num >> shift) & 1) == 1 {
|
||||
println!("Shift success");
|
||||
dbg!("Shift success");
|
||||
powers.push(shift);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue