advent-of-code/_templates/riddle/new/rust.ejs.t

47 lines
760 B
Perl
Raw Normal View History

2023-11-18 16:06:39 +00:00
---
to: <%= dir %>/rust/main.rs
unless_exists: true
---
2023-11-18 16:52:07 +00:00
#![feature(test)]
extern crate test;
#[cfg(test)]
mod tests {
use super::*;
use test::Bencher;
#[bench]
fn bench_a(b: &mut Bencher) {
2023-11-19 15:51:08 +00:00
b.iter(|| part_a(INPUT));
2023-11-18 16:52:07 +00:00
}
#[bench]
fn bench_b(b: &mut Bencher) {
2023-11-19 15:51:08 +00:00
b.iter(|| part_b(INPUT));
2023-11-18 16:52:07 +00:00
}
}
2023-11-19 15:51:08 +00:00
const INPUT: &str = include_str!("../input.txt");
const TEST: &str = include_str!("../test.txt");
fn part_a(input: &str) {
let result = input.trim();
println!("{}", result);
2023-11-18 16:52:07 +00:00
}
2023-11-19 15:51:08 +00:00
fn part_b(input: &str) {
let result = input.trim();
println!("{}", result);
2023-11-18 16:52:07 +00:00
}
2023-11-18 16:06:39 +00:00
fn main() {
2023-11-19 15:51:08 +00:00
println!("Part A:");
part_a(TEST);
// part_a(INPUT);
println!("\nPart B:");
part_b(TEST);
// part_b(INPUT);
2023-11-18 16:06:39 +00:00
}