use std::cli; use std::text; use vendor::auction_close::auction_close; fn main() { let arguments = cli_args(); if args_len(arguments) > 0 { if args_len(arguments) % 2 != 0 { stderr_line("Expected event and value pairs"); process_exit(2); } let mut live = auction_close_start(); let mut i = 0; while i < args_len(arguments) { let input = args_at(arguments, i + 1); if !text_is_number(input) { stderr_line("Expected a whole numeric event value"); process_exit(2); } live = auction_close_step(live, args_at(arguments, i), text_number(input)); let command = auction_close_command(live); println!(command); if command == "reject" { process_exit(1); } i += 2; } return; } let mut state = auction_close_start(); state = auction_close_step(state, "open", 20.0); println!(auction_close_command(state)); state = auction_close_step(state, "bid", 19.0); println!(auction_close_command(state)); state = auction_close_step(state, "bid", 20.0); println!(auction_close_command(state)); state = auction_close_step(state, "bid", 23.0); println!(auction_close_command(state)); state = auction_close_step(state, "close", 0.0); println!(auction_close_command(state)); state = auction_close_step(state, "paid", 23.0); println!(auction_close_command(state)); }