Move mockall to dev-dependencies

This commit is contained in:
Nicolas 2022-04-11 20:27:38 +02:00
parent d914bdfe75
commit 941ecfb757
9 changed files with 24 additions and 10 deletions

View File

@ -14,4 +14,6 @@ anyhow = "1.0"
clap = { version = "3.1", features = ["derive"]}
crossterm = "0.23"
rand = "0.8"
[dev-dependencies]
mockall = "0.11"

View File

@ -4,9 +4,10 @@ pub mod rhombus;
use crate::vec::Vector;
#[cfg(test)]
use mockall::automock;
#[automock]
#[cfg_attr(test, automock)]
pub trait Animation {
fn sample(&self, step: f32, pos: Vector) -> f32;
}

View File

@ -1,7 +1,8 @@
#[cfg(test)]
use mockall::automock;
/// Used to get a character with a given brightness.
#[automock]
#[cfg_attr(test, automock)]
pub trait CharSampler {
/// Gets a character with the given brightness.
/// # Arguments

View File

@ -1,8 +1,10 @@
use crossterm::style::Color;
#[cfg(test)]
use mockall::automock;
/// A collection of colors.
#[automock]
#[cfg_attr(test, automock)]
pub trait ColorSampler {
/// Gets a color for the given fill.
/// # Arguments

View File

@ -4,10 +4,11 @@ pub mod stripes;
use crate::vec::Vector;
#[cfg(test)]
use mockall::automock;
/// Used to choose the colors of characters.
#[automock]
#[cfg_attr(test, automock)]
pub trait FillMode {
/// Gets the color for this character.
fn sample(&self, level: f32, pos: Vector) -> f32;

View File

@ -3,9 +3,10 @@ use crate::sampler::{Sample, Sampler};
use crate::surface::Surface;
use crate::Vector;
#[cfg(test)]
use mockall::automock;
#[automock]
#[cfg_attr(test, automock)]
pub trait Renderer {
fn render(&mut self, step: f32);
fn present(&mut self) -> Result<(), Error>;

View File

@ -1,18 +1,20 @@
use crossterm::style::Color;
use mockall::automock;
use crate::animation::Animation;
use crate::char::CharSampler;
use crate::color::ColorSampler;
use crate::fill::FillMode;
use crate::vec::Vector;
#[cfg(test)]
use mockall::automock;
pub enum Sample {
Keep,
Draw { char: char, color: Color },
Clear,
}
#[automock]
#[cfg_attr(test, automock)]
pub trait Sampler {
fn sample(&self, step: f32, pos: Vector) -> Sample;
}

View File

@ -3,11 +3,13 @@ use crossterm::cursor::MoveTo;
use crossterm::{ExecutableCommand, QueueableCommand};
use crossterm::style::{Color, Print, SetForegroundColor};
use crossterm::terminal::{Clear, ClearType};
use mockall::automock;
use std::io::Write;
use crate::array::Array2D;
#[automock]
#[cfg(test)]
use mockall::automock;
#[cfg_attr(test, automock)]
pub trait Surface {
fn width(&self) -> usize;
fn height(&self) -> usize;

View File

@ -1,8 +1,10 @@
use std::thread::sleep;
use std::time::{Duration, Instant};
#[cfg(test)]
use mockall::automock;
#[automock]
#[cfg_attr(test, automock)]
pub trait Timer {
fn sleep(&mut self);