names and hiero

This commit is contained in:
ntr 2019-07-29 12:20:56 +10:00
parent e5c8b78ec1
commit 1940c437b0
2 changed files with 38 additions and 15 deletions

View File

@ -5,6 +5,7 @@ use rand::distributions::{Normal, WeightedIndex};
use std::fs::copy; use std::fs::copy;
use std::fs::File; use std::fs::File;
use std::io::prelude::*; use std::io::prelude::*;
use std::char::from_u32;
use failure::Error; use failure::Error;
use failure::err_msg; use failure::err_msg;
@ -83,10 +84,26 @@ pub fn invader_write(id: Uuid) -> Result<Uuid, Error> {
Ok(id) Ok(id)
} }
fn hieroglyph() -> String {
let mut rng = thread_rng();
// #[cfg(test)] let mut s = String::new();
// mod tests { for i in 0..4 {
// use super::*; s.push(from_u32(rng.gen_range(0x13000, 0x1342E)).unwrap());
if i == 1 {
// newline
s.push(from_u32(0x000a).unwrap());
}
}
// println!("{:}", s);
return s;
}
#[cfg(test)]
mod tests {
use super::*;
// #[test] // #[test]
// fn invader_img_test() { // fn invader_img_test() {
@ -94,7 +111,12 @@ pub fn invader_write(id: Uuid) -> Result<Uuid, Error> {
// invader_img_write(Uuid::new_v4()).unwrap(); // invader_img_write(Uuid::new_v4()).unwrap();
// } // }
// } // }
// }
#[test]
fn hieroglyph_test() {
hieroglyph();
}
}

View File

@ -1,13 +1,14 @@
use rand::prelude::*; use rand::prelude::*;
use rand::{thread_rng}; use rand::{thread_rng};
const FIRSTS: [&'static str; 42] = [ const FIRSTS: [&'static str; 44] = [
"artificial", "artificial",
"ambient", "ambient",
"borean", "borean",
"brewing", "brewing",
"bristling", "bristling",
"compressed", "compressed",
"ceramic",
"chromatic", "chromatic",
"concave", "concave",
"convex", "convex",
@ -40,18 +41,20 @@ const FIRSTS: [&'static str; 42] = [
"rogue", "rogue",
"subversive", "subversive",
"subterranean", "subterranean",
"subsonic",
"synthetic", "synthetic",
"sweet", "sweet",
"terrestrial", "terrestrial",
"weary", "weary",
]; ];
const LASTS: [&'static str; 49] = [ const LASTS: [&'static str; 48] = [
"artifact", "artifact",
"assembly", "assembly",
"carbon", "carbon",
"console", "console",
"construct", "construct",
"craft",
"design", "design",
"drone", "drone",
"distortion", "distortion",
@ -82,7 +85,6 @@ const LASTS: [&'static str; 49] = [
"receiver", "receiver",
"replicant", "replicant",
"river", "river",
"river",
"scaffold", "scaffold",
"structure", "structure",
"shape", "shape",
@ -95,7 +97,6 @@ const LASTS: [&'static str; 49] = [
"vibration", "vibration",
"warning", "warning",
"wildlife", "wildlife",
"witness",
]; ];
pub fn name() -> String { pub fn name() -> String {