feat: ensure tests pass

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-02-09 14:48:19 -06:00
parent aa68942d84
commit 0474f59ac4
6 changed files with 34 additions and 27 deletions

2
Cargo.lock generated
View File

@ -1,7 +1,7 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "ba-gacha" name = "bluearch-recruitment"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"rand", "rand",

View File

@ -1,5 +1,5 @@
[package] [package]
name = "ba-gacha" name = "bluearch-recruitment"
version = "0.1.0" version = "0.1.0"
authors = ["Rekai Musuka <rekai@musuka.dev>"] authors = ["Rekai Musuka <rekai@musuka.dev>"]
edition = "2018" edition = "2018"

View File

@ -21,7 +21,7 @@ impl BannerBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::banner::BannerBuilder; /// # use bluearch_recruitment::banner::BannerBuilder;
/// let banner_builder = BannerBuilder::new("ピックアップ募集"); /// let banner_builder = BannerBuilder::new("ピックアップ募集");
/// ``` /// ```
pub fn new(jpn_name: &str) -> Self { pub fn new(jpn_name: &str) -> Self {
@ -39,8 +39,8 @@ impl BannerBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::banner::BannerBuilder; /// # use bluearch_recruitment::banner::BannerBuilder;
/// # use ba_gacha::i18n::Language; /// # use bluearch_recruitment::i18n::Language;
/// let banner_builder = BannerBuilder::new("ピックアップ募集") /// let banner_builder = BannerBuilder::new("ピックアップ募集")
/// .with_name_translation(Language::English, "Focus Recruitment"); /// .with_name_translation(Language::English, "Focus Recruitment");
/// ``` /// ```
@ -56,8 +56,8 @@ impl BannerBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::GachaBuilder; /// # use bluearch_recruitment::gacha::GachaBuilder;
/// # use ba_gacha::banner::BannerBuilder; /// # use bluearch_recruitment::banner::BannerBuilder;
/// let gacha = GachaBuilder::default() /// let gacha = GachaBuilder::default()
/// .with_pool(Vec::new()) /// .with_pool(Vec::new())
/// .finish().unwrap(); /// .finish().unwrap();
@ -79,7 +79,12 @@ impl BannerBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::banner::BannerBuilder; /// # use bluearch_recruitment::student::Student;
/// # use bluearch_recruitment::banner::BannerBuilder;
/// let students = Vec::new();
/// let banner_builder = BannerBuilder::new("ピックアップ募集")
/// .with_sparkable_students(&students);
/// ```
pub fn with_sparkable_students(self, students: &[Student]) -> Self { pub fn with_sparkable_students(self, students: &[Student]) -> Self {
Self { Self {
sparkable: Some(students.to_vec()), sparkable: Some(students.to_vec()),

View File

@ -67,7 +67,7 @@ impl GachaBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::GachaBuilder; /// # use bluearch_recruitment::gacha::GachaBuilder;
/// let gacha_builder: GachaBuilder = GachaBuilder::new(79.0, 18.5, 2.5) /// let gacha_builder: GachaBuilder = GachaBuilder::new(79.0, 18.5, 2.5)
/// .with_pool(Vec::new()); /// .with_pool(Vec::new());
/// ``` /// ```
@ -91,8 +91,8 @@ impl GachaBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::{GachaBuilder, Rarity}; /// # use bluearch_recruitment::gacha::{GachaBuilder, Rarity};
/// # use ba_gacha::student::Student; /// # use bluearch_recruitment::student::Student;
/// ///
/// let aru = Student::new("アル", Rarity::Three); /// let aru = Student::new("アル", Rarity::Three);
/// let hina = Student::new("ヒナ", Rarity::Three); /// let hina = Student::new("ヒナ", Rarity::Three);
@ -113,13 +113,15 @@ impl GachaBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::{GachaBuilder, Rarity}; /// # use bluearch_recruitment::gacha::{GachaBuilder, Rarity};
/// # use ba_gacha::student::Student; /// # use bluearch_recruitment::student::Student;
/// let aru = Student::new("アル", Rarity::Three); /// let aru = Student::new("アル", Rarity::Three);
/// let hina = Student::new("ヒナ", Rarity::Three); /// let hina = Student::new("ヒナ", Rarity::Three);
/// let rate_up = vec![aru, hina.clone()];
/// let priority = vec![hina];
/// let gacha_builder = GachaBuilder::new(79.0, 18.5, 2.5) /// let gacha_builder = GachaBuilder::new(79.0, 18.5, 2.5)
/// .with_pool(vec![aru, hina.clone()]) /// .with_pool(rate_up)
/// .with_priority(vec![hina], 3.5); /// .with_priority(&priority, 3.5);
/// ``` /// ```
pub fn with_priority(self, students: &[Student], total_rate: f32) -> Self { pub fn with_priority(self, students: &[Student], total_rate: f32) -> Self {
Self { Self {
@ -135,8 +137,8 @@ impl GachaBuilder {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::{GachaBuilder, Gacha, Rarity}; /// # use bluearch_recruitment::gacha::{GachaBuilder, Gacha, Rarity};
/// # use ba_gacha::student::Student; /// # use bluearch_recruitment::student::Student;
/// let aru = Student::new("アル", Rarity::Three); /// let aru = Student::new("アル", Rarity::Three);
/// let hina = Student::new("ヒナ", Rarity::Three); /// let hina = Student::new("ヒナ", Rarity::Three);
/// let gacha = GachaBuilder::default() /// let gacha = GachaBuilder::default()
@ -171,7 +173,7 @@ impl Gacha {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::{GachaBuilder, Rarity}; /// # use bluearch_recruitment::gacha::{GachaBuilder, Rarity};
/// let gacha = GachaBuilder::new(79.0, 18.5, 2.5) /// let gacha = GachaBuilder::new(79.0, 18.5, 2.5)
/// .with_pool(Vec::new()) /// .with_pool(Vec::new())
/// .finish() /// .finish()

View File

@ -1,7 +1,7 @@
use ba_gacha::banner::BannerBuilder; use bluearch_recruitment::banner::BannerBuilder;
use ba_gacha::gacha::{GachaBuilder, Recruitment}; use bluearch_recruitment::gacha::{GachaBuilder, Recruitment};
use ba_gacha::i18n::Language; use bluearch_recruitment::i18n::Language;
use ba_gacha::student::Student; use bluearch_recruitment::student::Student;
use std::{fs::File, io::Read}; use std::{fs::File, io::Read};
fn main() { fn main() {

View File

@ -25,8 +25,8 @@ impl Student {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::Rarity; /// # use bluearch_recruitment::gacha::Rarity;
/// # use ba_gacha::student::Student; /// # use bluearch_recruitment::student::Student;
/// ///
/// let mutsuki = Student::new("ムツキ", Rarity::Two); /// let mutsuki = Student::new("ムツキ", Rarity::Two);
/// ``` /// ```
@ -45,9 +45,9 @@ impl Student {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// # use ba_gacha::gacha::Rarity; /// # use bluearch_recruitment::gacha::Rarity;
/// # use ba_gacha::student::Student; /// # use bluearch_recruitment::student::Student;
/// # use ba_gacha::i18n::Language; /// # use bluearch_recruitment::i18n::Language;
/// ///
/// let mut mutsuki = Student::new("ムツキ", Rarity::Two); /// let mut mutsuki = Student::new("ムツキ", Rarity::Two);
/// mutsuki.add_translation(Language::English, "Mutsuki"); /// mutsuki.add_translation(Language::English, "Mutsuki");