Test: Playfield test
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -3,9 +3,13 @@ use clap::{Parser, Subcommand};
|
|||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(version, about, long_about = None)]
|
#[command(version, about, long_about = None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
// The sudoku field given as a 1x81 string from left to right, top to bottom, 0 denotes value
|
// The sudoku field given as a space separated string from left to right, top to bottom, 0 denotes value
|
||||||
// absense
|
// absense
|
||||||
field: String,
|
field: String,
|
||||||
|
|
||||||
|
// Size of one size of the field. For standard 3x3 input 3 (default)
|
||||||
|
#[arg(short, long)]
|
||||||
|
field_size: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Playfield {
|
struct Playfield {
|
||||||
@@ -21,14 +25,22 @@ struct Field {
|
|||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let playfield = parse_field(&cli.field);
|
let playfield = parse_playfield(&cli.field, cli.field_size);
|
||||||
|
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_field(field: &String) -> Playfield {}
|
fn parse_playfield(field: &String, field_size: u16) -> Playfield {}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_field() {}
|
fn test_parse_field() {
|
||||||
|
let input = "1 2 3 0 0 0 1 2 3";
|
||||||
|
let field_size = 2;
|
||||||
|
|
||||||
|
let playfield = parse_playfield(&input.to_string(), field_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user