Pass properties as integers internally
This commit is contained in:
+3
-3
@@ -21,7 +21,7 @@ pub mod wikipedia_infobox_analyzer {
|
||||
}
|
||||
|
||||
/// Creates an ascii infobox out of the properties
|
||||
pub fn format_infobox_from_used_properties(name: String, properties: Vec<String>) -> String {
|
||||
pub fn format_infobox_from_used_properties(name: String, properties: Vec<u64>) -> String {
|
||||
let mut ascii_table = AsciiTable::default();
|
||||
ascii_table.set_max_width(26);
|
||||
ascii_table
|
||||
@@ -29,7 +29,7 @@ pub mod wikipedia_infobox_analyzer {
|
||||
.set_header(name)
|
||||
.set_align(Align::Left);
|
||||
|
||||
let data: Vec<Vec<&String>> = properties.iter().map(|v| vec![v]).collect();
|
||||
let data: Vec<Vec<String>> = properties.iter().map(|v| vec![format!("P{v}")]).collect();
|
||||
ascii_table.format(data)
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
format_infobox_from_used_properties(
|
||||
"Earth".to_string(),
|
||||
vec!["P31".to_string(), "P361".to_string(), "P571".to_string()]
|
||||
vec![31, 361, 571]
|
||||
),
|
||||
concat![
|
||||
"┌───────┐\n",
|
||||
|
||||
Reference in New Issue
Block a user