Commit e393f718 authored by Meade's avatar Meade

Added version 6.1.0. Made use lines explicit. Fixed floating point...

Added version 6.1.0. Made use lines explicit. Fixed floating point comparisons. Changed .validInput() to use .is_nan(). Adapted all logic to use .is_nan() to match.
parent 8ff698a9
## New In 6.1.0
* * Made use lines explicit
* * Fixed strict floating point comparisons
* * Changed `.validInput()` to return NAN instead of 0.0. Also changed all logic to use `.is_nan()` to match.
## New In 6.0.2
* Changed BrewStilleryIcon to be an svg. Also changed all corresponding files to match. Fixed install script permissions.
## New In 6.0.1
* Moved `startGTK()` into its own module so the `mod.rs` is just modules.
* Properly configured the tests module in `main.rs` with the `#[cfg(test)]` flag and removed unused imports in some tests.
* Updated `gtkCSS()` to the latest `get_default_screen()` arguments.
* Updated `gtkCSS()` to the latest `.get_default_screen()` arguments.
* Moved the `clone!()` macro into `macroDefinitions.rs` so the `mod.rs` is just modules.
## New In 6.0.0
......
This diff is collapsed.
[package]
name = "BrewStillery"
version = "6.0.2"
version = "6.1.0"
authors = ["Meade <thedarkula2049@gmail.com>", "Emily <marleybrush5@gmail.com>"]
description = "BrewStillery is a brewer's, vintner's, and distiller's calculator. It has a multitude of great functions, such as calculating ABV, determining carbonation, and total sparge water needed."
# documentation to come
......@@ -16,13 +16,12 @@ license = "AGPL-3.0"
maintenance = { status = "actively-developed" }
[dependencies.gtk]
version = "0.4.0"
version = "0.4.1"
features = ["v3_22"]
[dependencies]
gdk = "0.8.0"
gio = "0.4.0"
clippy = {version = "0.0.189", optional = true}
[features]
default = []
......
......@@ -4,8 +4,10 @@ It has a multitude of great functions, such as calculating ABV, determining carb
Written in Rust, using GTK3
## New In 6.0.2
* * Changed BrewStilleryIcon to be an svg. Also changed all corresponding files to match. Fixed install script permissions.
## New In 6.1.0
* * Made use lines explicit
* * Fixed strict floating point comparisons
* * Changed `.validInput()` to return NAN instead of 0.0. Also changed all logic to use `.is_nan()` to match.
## Full Changelog
* [Available Here](CHANGELOG.md)
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput};
pub fn champagneCarbonationPrep(champagneCarbonationBuilderClone: &gtk::Builder) {
let champagneCarbonationVolume: gtk::Entry = champagneCarbonationBuilderClone.get_object("champagneCarbonationVolume").expect("champagneCarbonationPrep(), champagneCarbonationVolume");
pub fn champagneCarbonationPrep(champagneCarbonationBuilder: &gtk::Builder) {
let champagneCarbonationVolume: gtk::Entry = champagneCarbonationBuilder.get_object("champagneCarbonationVolume").expect("champagneCarbonationPrep(), champagneCarbonationVolume");
let champagneCarbonationVolumeBuffer = champagneCarbonationVolume.get_text().expect("champagneCarbonationPrep(), champagneCarbonationVolumeBuffer");
let champagneVolume = champagneCarbonationVolumeBuffer.validInput();
let champagneCarbonationSugar: gtk::Entry = champagneCarbonationBuilderClone.get_object("champagneCarbonationSugar").expect("champagneCarbonationPrep(), champagneCarbonationSugar");
let champagneCarbonationSugar: gtk::Entry = champagneCarbonationBuilder.get_object("champagneCarbonationSugar").expect("champagneCarbonationPrep(), champagneCarbonationSugar");
let champagneCarbonationUnits: gtk::ComboBoxText = champagneCarbonationBuilderClone.get_object("champagneCarbonationUnits").expect("champagneCarbonationPrep(), champagneCarbonationUnits");
let champagneCarbonationUnits: gtk::ComboBoxText = champagneCarbonationBuilder.get_object("champagneCarbonationUnits").expect("champagneCarbonationPrep(), champagneCarbonationUnits");
let champagneCarbonationUnitsBuffer = champagneCarbonationUnits.get_active_id().expect("champagneCarbonationPrep(), champagneCarbonationUnitsBuffer");
let imperialOrMetric = champagneCarbonationUnitsBuffer.unitMatch();
if champagneVolume == 0.0 {
if champagneVolume.is_nan() {
champagneCarbonationSugar.set_text("Enter a number");
} else if champagneVolume <= 0.0 {
champagneCarbonationSugar.set_text("Enter a positive number");
} else {
let totalSugar = champagneCarbonationMaths(champagneVolume, imperialOrMetric);
champagneOutput(totalSugar, imperialOrMetric, champagneCarbonationBuilderClone)
champagneOutput(totalSugar, imperialOrMetric, champagneCarbonationBuilder)
}
}
......@@ -45,7 +45,7 @@ pub fn champagneCarbonationFormatting(totalSugar: f64, imperialOrMetric: imperia
sugar = format!("{:.2} oz", totalSugar.remainingOunces());
} else if totalSugar >= 0.995 && totalSugar < 1.005 {
sugar = format!("{:.0} lb", totalSugar);
} else if totalSugar.trunc() == 1.0 && totalSugar.remainingOunces() < 15.995 {
} else if totalSugar.trunc() as i64 == 1 && totalSugar.remainingOunces() < 15.995 {
sugar = format!("{:.0} lb {:.2} oz", totalSugar.trunc(), totalSugar.remainingOunces());
} else if totalSugar.fract() == 0.0 || totalSugar.remainingOunces() < 0.005 || totalSugar.remainingOunces() >= 15.995 {
sugar = format!("{:.0} lbs", totalSugar);
......@@ -65,8 +65,8 @@ pub fn champagneCarbonationFormatting(totalSugar: f64, imperialOrMetric: imperia
sugar
}
fn champagneOutput(totalSugar: f64, imperialOrMetric: imperialOrMetric, champagneCarbonationBuilderClone: &gtk::Builder) {
let champagneCarbonationSugar: gtk::Entry = champagneCarbonationBuilderClone.get_object("champagneCarbonationSugar").expect("champagneCarbonationPrep(), champagneCarbonationSugar");
fn champagneOutput(totalSugar: f64, imperialOrMetric: imperialOrMetric, champagneCarbonationBuilder: &gtk::Builder) {
let champagneCarbonationSugar: gtk::Entry = champagneCarbonationBuilder.get_object("champagneCarbonationSugar").expect("champagneCarbonationPrep(), champagneCarbonationSugar");
let sugar = champagneCarbonationFormatting(totalSugar, imperialOrMetric);
......
use std::f64::consts::E;
use gtk;
use gdk::RGBA;
use std::f64::NAN;
pub const FINAL_GRAVITY_IDEAL: f64 = 1.01627;
// when finalGravity is unknown, this constant is ideal. it is the average of all BJCP styles
......@@ -64,7 +65,7 @@ impl inputMatching for str {
fn validInput(&self) -> f64 {
match self.parse::<f64>() {
Ok(number) => number,
Err(_) => 0.0,
Err(_) => NAN,
}
}
......@@ -236,7 +237,7 @@ pub fn realIBU(brix: f64, wortVolume: f64, alphaAcid: f64, hopAmount: f64, boilT
(1.65 * 0.000125_f64.powf(brix.brixToGravity() - 1.0)) * ((1.0 - E.powf(-0.04 * boilTime)) / 4.15) * (( (alphaAcid / 100.0) * hopAmount * 7490.0 ) / wortVolume)
}
pub fn realABV(startingBrix: f64, finalBrix: f64) -> (f64, f64) {
pub fn realABVAndAttenuation(startingBrix: f64, finalBrix: f64) -> (f64, f64) {
let wortCorrectionFactor: f64 = 1.040;
let initialRefractiveIndex = startingBrix / wortCorrectionFactor;
let finalRefractiveIndex = finalBrix / wortCorrectionFactor;
......@@ -271,12 +272,10 @@ pub fn grainToGravity(volumeInGallonsUS: f64, weightInPounds: f64, grainGravity:
// when const fn hits stable, we can create a constant called RGBA_ZERO that uses zeroRGBA()
pub fn zeroRGBA() -> RGBA {
let zeroRGBA = RGBA {
RGBA {
red: 255.0,
green: 255.0,
blue: 255.0,
alpha: 1.0,
};
zeroRGBA
}
}
\ No newline at end of file
This diff is collapsed.
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{inputMatching, realABVAndAttenuation, FINAL_BRIX_IDEAL};
pub fn guestimateABVPrep(guestimatorBuilder: &gtk::Builder) {
let guestimatorStartingBrix: gtk::Entry = guestimatorBuilder.get_object("guestimatorStartingBrix").expect("guestimateABVPrep(), guestimatorStartingBrix");
......@@ -8,7 +8,7 @@ pub fn guestimateABVPrep(guestimatorBuilder: &gtk::Builder) {
let startingBrix = guestimatorStartingBrixBuffer.validInput();
let guestimatorTemporaryOutput: gtk::Entry = guestimatorBuilder.get_object("guestimatorABV").expect("guestimateABVPrep(), guestimatorTemporaryOutput");
if startingBrix == 0.0 {
if startingBrix.is_nan() {
guestimatorTemporaryOutput.set_text("Enter a number");
} else if startingBrix < 2.57 {
guestimatorTemporaryOutput.set_text("Enter a Brix greater than 2.57");
......@@ -20,7 +20,7 @@ pub fn guestimateABVPrep(guestimatorBuilder: &gtk::Builder) {
}
pub fn guestimateABVFormatting(startingBrix: f64) -> String {
let finalABV = format!("{:.2}%", realABV(startingBrix, FINAL_BRIX_IDEAL).0);
let finalABV = format!("{:.2}%", realABVAndAttenuation(startingBrix, FINAL_BRIX_IDEAL).0);
finalABV
}
......
This diff is collapsed.
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, FINAL_GRAVITY_IDEAL};
#[derive(Debug)]
pub struct gyleData {
......@@ -34,7 +34,7 @@ pub fn gyleCarbonationPrep(gyleBuilder: &gtk::Builder) {
gyleTemporaryOutput.set_text("Enter a Starting Brix greater than 2.57");
} else if startingBrix > 49.48 {
gyleTemporaryOutput.set_text("Enter a Starting Brix less than 49.48");
} else if startingBrix == 0.0 || desiredCO2LevelTemp == 0.0 || finalVolumeTemp == 0.0 {
} else if startingBrix.is_nan() || desiredCO2LevelTemp.is_nan() || finalVolumeTemp.is_nan() {
gyleTemporaryOutput.set_text("Enter all 3 inputs");
} else if startingBrix <= 0.0 || desiredCO2LevelTemp <= 0.0 || finalVolumeTemp <= 0.0 {
gyleTemporaryOutput.set_text("Enter a positive number");
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, realABVAndAttenuation, FINAL_BRIX_IDEAL};
#[derive(Debug)]
pub struct increaseABVData {
......@@ -56,7 +56,7 @@ pub fn increaseABVPrep(increaseABVBuilder: &gtk::Builder) {
increaseABVFinalBrix.set_text("Enter a brix less than 49.48");
increaseABVSugar.set_text("");
increaseABVHoney.set_text("");
} else if allInputs.startingBrix == 0.0 || allInputs.desiredABV == 0.0 || allInputs.currentVolume == 0.0 {
} else if allInputs.startingBrix.is_nan() || allInputs.desiredABV.is_nan() || allInputs.currentVolume.is_nan() {
increaseABVFinalBrix.set_text("Enter all 3 inputs");
increaseABVSugar.set_text("");
increaseABVHoney.set_text("");
......@@ -71,11 +71,11 @@ pub fn increaseABVPrep(increaseABVBuilder: &gtk::Builder) {
pub fn increaseABVMaths(allInputs: &increaseABVData) -> finalSugarFloat {
let mut newStartingBrix = allInputs.startingBrix;
let mut newEstimatedABV = realABV(newStartingBrix, FINAL_BRIX_IDEAL).0;
let mut newEstimatedABV = realABVAndAttenuation(newStartingBrix, FINAL_BRIX_IDEAL).0;
while newEstimatedABV <= allInputs.desiredABV {
newStartingBrix = newStartingBrix + 0.001;
newEstimatedABV = realABV(newStartingBrix, FINAL_BRIX_IDEAL).0;
newEstimatedABV = realABVAndAttenuation(newStartingBrix, FINAL_BRIX_IDEAL).0;
}
let differenceBrix = newStartingBrix - allInputs.startingBrix;
......@@ -114,7 +114,7 @@ pub fn increaseABVFormatting(allInputs: &increaseABVData, finalOutputFloat: fina
finalOutput.sugarAmount = format!("{:.2} oz", finalOutputFloat.sugarToAdd.remainingOunces());
} else if finalOutputFloat.sugarToAdd >= 0.995 && finalOutputFloat.sugarToAdd < 1.005 {
finalOutput.sugarAmount = format!("{:.0} lb", finalOutputFloat.sugarToAdd);
} else if finalOutputFloat.sugarToAdd.trunc() == 1.0 && finalOutputFloat.sugarToAdd.remainingOunces() < 15.995 {
} else if finalOutputFloat.sugarToAdd.trunc() as i64 == 1 && finalOutputFloat.sugarToAdd.remainingOunces() < 15.995 {
finalOutput.sugarAmount = format!("{:.0} lb {:.2} oz", finalOutputFloat.sugarToAdd.trunc(), finalOutputFloat.sugarToAdd.remainingOunces());
} else if finalOutputFloat.sugarToAdd.fract() == 0.0 || finalOutputFloat.sugarToAdd.remainingOunces() < 0.005 || finalOutputFloat.sugarToAdd.remainingOunces() >= 15.995 {
finalOutput.sugarAmount = format!("{:.0} lbs", finalOutputFloat.sugarToAdd);
......@@ -126,7 +126,7 @@ pub fn increaseABVFormatting(allInputs: &increaseABVData, finalOutputFloat: fina
finalOutput.honeyAmount = format!("{:.2} oz", finalOutputFloat.honeyToAdd.remainingOunces());
} else if finalOutputFloat.honeyToAdd >= 0.995 && finalOutputFloat.honeyToAdd < 1.005 {
finalOutput.honeyAmount = format!("{:.0} lb", finalOutputFloat.honeyToAdd);
} else if finalOutputFloat.honeyToAdd.trunc() == 1.0 && finalOutputFloat.honeyToAdd.remainingOunces() < 15.995 {
} else if finalOutputFloat.honeyToAdd.trunc() as i64 == 1 && finalOutputFloat.honeyToAdd.remainingOunces() < 15.995 {
finalOutput.honeyAmount = format!("{:.0} lb {:.2} oz", finalOutputFloat.honeyToAdd.trunc(), finalOutputFloat.honeyToAdd.remainingOunces());
} else if finalOutputFloat.honeyToAdd.fract() == 0.0 || finalOutputFloat.honeyToAdd.remainingOunces() < 0.005 || finalOutputFloat.honeyToAdd.remainingOunces() >= 15.995 {
finalOutput.honeyAmount = format!("{:.0} lbs", finalOutputFloat.honeyToAdd);
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{inputMatching, realABVAndAttenuation};
pub fn realABVPrep(realABVBuilder: &gtk::Builder) {
let realABVStartingBrix: gtk::Entry = realABVBuilder.get_object("realABVStartingBrix").expect("realABVPrep(), realABVStartingBrix");
......@@ -14,7 +14,7 @@ pub fn realABVPrep(realABVBuilder: &gtk::Builder) {
let realABVFinalABV: gtk::Entry = realABVBuilder.get_object("realABVFinalABV").expect("realABVPrep(), realABVFinalABV");
let realABVRealAttenuation: gtk::Entry = realABVBuilder.get_object("realABVRealAttenuation").expect("realABVPrep(), realABVRealAttenuation");
if startingBrix == 0.0 || finalBrix == 0.0 {
if startingBrix.is_nan() || finalBrix.is_nan() {
realABVFinalABV.set_text("Enter both inputs");
realABVRealAttenuation.set_text("");
} else if startingBrix <= 0.0 || finalBrix <= 0.0 {
......@@ -53,7 +53,7 @@ fn realABVOutput(startingBrix: f64, finalBrix: f64, realABVBuilder: &gtk::Builde
let realABVRealAttenuation: gtk::Entry = realABVBuilder.get_object("realABVRealAttenuation").expect("realABVOutput(), realABVRealAttenuation");
let realABVFinalABV: gtk::Entry = realABVBuilder.get_object("realABVFinalABV").expect("realABVOutput(), realABVFinalABV");
let (abv, attenuation) = realABV(startingBrix, finalBrix);
let (abv, attenuation) = realABVAndAttenuation(startingBrix, finalBrix);
let (abvFormatted, attenuationFormatted) = realABVFormatting(abv, attenuation);
realABVFinalABV.set_text(&abvFormatted);
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput};
#[derive(Debug)]
pub struct waterSpargeData {
......@@ -60,11 +60,11 @@ pub fn waterSpargePrep(waterSpargeBuilder: &gtk::Builder) {
imperialOrMetric: waterSpargeUnitsBuffer.unitMatch(),
};
if allInputs.preFermentVolume < 0.0 || allInputs.totalGrain < 0.0 || allInputs.boilTime * 60.0 < 0.0 {
if allInputs.preFermentVolume <= 0.0 || allInputs.totalGrain <= 0.0 || allInputs.boilTime * 60.0 <= 0.0 {
spargeMashWater.set_text("Enter a positive number");
spargeSpargeWater.set_text("");
spargeTotalWater.set_text("");
} else if allInputs.preFermentVolume == 0.0 || allInputs.totalGrain == 0.0 || allInputs.boilTime * 60.0 == 0.0 {
} else if allInputs.preFermentVolume.is_nan() || allInputs.totalGrain.is_nan() || allInputs.boilTime.is_nan() {
spargeMashWater.set_text("Enter all 3 inputs");
spargeSpargeWater.set_text("");
spargeTotalWater.set_text("");
......
......@@ -2657,7 +2657,7 @@
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Version 6.0.2</property>
<property name="label" translatable="yes">Version 6.1.0</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -2740,7 +2740,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">BrewStillery</property>
<property name="subtitle">6.0.2</property>
<property name="subtitle">6.1.0</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
......
use gtk;
use gtk::prelude::*;
use functions::champagneCarbonation::*;
use functions::champagneCarbonation::champagneCarbonationPrep;
pub fn champagneCarbonationGUI(builder: &gtk::Builder) {
let champagneCarbonationVolume: gtk::Entry = builder.get_object("champagneCarbonationVolume").expect("champagneCarbonationGUI(), champagneCarbonationVolume");
......
use gtk;
use gtk::prelude::*;
use functions::grainToABV::*;
use functions::commonFunctions::*;
use functions::grainToABV::grainToABVPrep;
use functions::commonFunctions::{allOverlays, zeroRGBA};
pub fn grainToABVGUI(builder: &gtk::Builder) {
let allOverlays = allOverlays::new(builder);
......
use gtk;
use gtk::prelude::*;
use functions::guestimateIBU::*;
use functions::guestimateIBU::guestimateIBUPrep;
pub fn guestimateIBUGUI(builder: &gtk::Builder) {
let totalIBUPreBoilBrix: gtk::Entry = builder.get_object("totalIBUPreBoilBrix").expect("guestimateIBUGUI(), totalIBUPreBoilBrix");
......
use gtk;
use gtk::prelude::*;
use functions::gyleCarbonation::*;
use functions::gyleCarbonation::gyleCarbonationPrep;
pub fn gyleCarbonationGUI(builder: &gtk::Builder) {
let gyleStartingBrix: gtk::Entry = builder.get_object("gyleStartingBrix").expect("gyleCarbonationGUI(), gyleStartingBrix");
......
use gtk;
use gtk::prelude::*;
use functions::increaseABV::*;
use functions::increaseABV::increaseABVPrep;
pub fn increaseABVGUI(builder: &gtk::Builder) {
let increaseABVStartingBrix: gtk::Entry = builder.get_object("increaseABVStartingBrix").expect("increaseABVGUI(), increaseABVStartingBrix");
......
use gtk;
use gtk::prelude::*;
use functions::realABV::*;
use functions::realABV::realABVPrep;
pub fn realABVGUI(builder: &gtk::Builder) {
let realABVStartingBrix: gtk::Entry = builder.get_object("realABVStartingBrix").expect("realABVGUI(), realABVStartingBrix");
......
use gtk;
use gtk::prelude::*;
use functions::waterSparge::*;
use functions::waterSparge::waterSpargePrep;
pub fn waterSpargeGUI(builder: &gtk::Builder) {
let spargePreFermentVolume: gtk::Entry = builder.get_object("spargePreFermentVolume").expect("waterSpargeGUI(), spargePreFermentVolume");
......
......@@ -28,13 +28,11 @@ pub fn threeArraySum(firstArray: [f64; 81], secondArray: [f64; 81], thirdArray:
}
pub fn singleMCU(volumeInGallons: f64, weightInPounds: f64, grainLVB: f64) -> f64 {
let singleMCU = (grainLVB * weightInPounds) / volumeInGallons;
singleMCU
(grainLVB * weightInPounds) / volumeInGallons
}
pub fn beerSRM(totalMCU: f64) -> f64 {
let beerSRM = 1.4922 * totalMCU.powf(0.6859);
beerSRM
1.4922 * totalMCU.powf(0.6859)
}
pub fn grainSRMToLAB(glassDiameter: f64, beerSRM: f64) -> (f64, f64, f64) {
......
use functions::commonFunctions::*;
use functions::champagneCarbonation::*;
use functions::commonFunctions::imperialOrMetric;
use functions::champagneCarbonation::{champagneCarbonationMaths, champagneCarbonationFormatting};
#[test]
fn champagneMathsImperialGBTest() {
......
use functions::commonFunctions::*;
use functions::grainToABV::*;
use functions::commonFunctions::imperialOrMetric;
use functions::grainToABV::{grainABVData, grainToABVMaths, grainToABVFormatting, grainToABVColour};
#[test]
fn grainToABVMathsImperialGBTest() {
......@@ -26,6 +26,13 @@ fn grainToABVMathsImperialGBTest() {
seventhGrainAmount: 0.0,
seventhGrainGravity: 1.0,
seventhGrainLovibond: 0.0,
totalGrain1: 0.0,
totalGrain2: 0.0,
totalGrain3: 0.0,
totalGrain4: 0.0,
totalGrain5: 0.0,
totalGrain6: 0.0,
totalGrain7: 0.0,
glassSize: 9.8,
startingBrix: 0.0,
abvFinal: 0.0,
......@@ -65,6 +72,13 @@ fn grainToABVMathsImperialUSTest() {
seventhGrainAmount: 0.0,
seventhGrainGravity: 1.0,
seventhGrainLovibond: 0.0,
totalGrain1: 0.0,
totalGrain2: 0.0,
totalGrain3: 0.0,
totalGrain4: 0.0,
totalGrain5: 0.0,
totalGrain6: 0.0,
totalGrain7: 0.0,
glassSize: 9.8,
startingBrix: 0.0,
abvFinal: 0.0,
......@@ -104,6 +118,13 @@ fn grainToABVMathsMetricTest() {
seventhGrainAmount: 0.0,
seventhGrainGravity: 1.0,
seventhGrainLovibond: 0.0,
totalGrain1: 0.0,
totalGrain2: 0.0,
totalGrain3: 0.0,
totalGrain4: 0.0,
totalGrain5: 0.0,
totalGrain6: 0.0,
totalGrain7: 0.0,
glassSize: 9.8,
startingBrix: 0.0,
abvFinal: 0.0,
......@@ -143,6 +164,13 @@ fn grainToABVFormattingTest() {
seventhGrainAmount: 0.0,
seventhGrainGravity: 1.0,
seventhGrainLovibond: 0.0,
totalGrain1: 0.0,
totalGrain2: 0.0,
totalGrain3: 0.0,
totalGrain4: 0.0,
totalGrain5: 0.0,
totalGrain6: 0.0,
totalGrain7: 0.0,
glassSize: 9.8,
startingBrix: 15.520375373329689,
abvFinal: 7.710344253574942,
......@@ -182,6 +210,13 @@ fn grainToABVColourTest() {
seventhGrainAmount: 0.0,
seventhGrainGravity: 1.0,
seventhGrainLovibond: 0.0,
totalGrain1: 0.0,
totalGrain2: 0.0,
totalGrain3: 0.0,
totalGrain4: 0.0,
totalGrain5: 0.0,
totalGrain6: 0.0,
totalGrain7: 0.0,
glassSize: 9.8,
startingBrix: 15.520375373329689,
abvFinal: 7.710344253574942,
......
use functions::commonFunctions::*;
use functions::commonFunctions::grainToGravity;
#[test]
fn grainToGravityTest() {
......
use functions::commonFunctions::*;
use functions::guestimateIBU::*;
use functions::commonFunctions::imperialOrMetric;
use functions::guestimateIBU::{guestimateIBUData, totalIBUMaths, totalIBUFormatting};
#[test]
fn totalBUMathsImperialGBTest() {
......@@ -27,6 +27,13 @@ fn totalBUMathsImperialGBTest() {
seventhHopAlpha: 0.0,
seventhHopAmount: 0.0,
seventhHopBoilTime: 0.0,
totalIBU1: 0.0,
totalIBU2: 0.0,
totalIBU3: 0.0,
totalIBU4: 0.0,
totalIBU5: 0.0,
totalIBU6: 0.0,
totalIBU7: 0.0,
imperialOrMetric: imperialOrMetric::imperialGB,
};
......@@ -61,6 +68,13 @@ fn totalBUMathsImperialUSTest() {
seventhHopAlpha: 0.0,
seventhHopAmount: 0.0,
seventhHopBoilTime: 0.0,
totalIBU1: 0.0,
totalIBU2: 0.0,
totalIBU3: 0.0,
totalIBU4: 0.0,
totalIBU5: 0.0,
totalIBU6: 0.0,
totalIBU7: 0.0,
imperialOrMetric: imperialOrMetric::imperialUS,
};
......@@ -95,6 +109,13 @@ fn totalBUMathsMetricTest() {
seventhHopAlpha: 0.0,
seventhHopAmount: 0.0,
seventhHopBoilTime: 0.0,
totalIBU1: 0.0,
totalIBU2: 0.0,
totalIBU3: 0.0,
totalIBU4: 0.0,
totalIBU5: 0.0,
totalIBU6: 0.0,
totalIBU7: 0.0,
imperialOrMetric: imperialOrMetric::metric,
};
......
use functions::commonFunctions::*;
use functions::gyleCarbonation::*;
use functions::commonFunctions::imperialOrMetric;
use functions::gyleCarbonation::{gyleData, gyleCarbonationMaths, gyleCarbonationFormatting};
#[test]
fn gyleCarbonationMathsImperialGBTest() {
......
use functions::commonFunctions::*;
use functions::commonFunctions::{inputMatching, imperialOrMetric, singleInput};
use std::f64::NAN;
#[test]
fn validInputTest() {
let emptyString = "";
let validString = "3.0";
assert_eq!(emptyString.validInput(), 0.0);
assert_eq!(emptyString.validInput().is_nan(), NAN.is_nan());
assert_eq!(validString.validInput(), 3.0);
}
......
use functions::commonFunctions::*;
use functions::increaseABV::*;
use functions::commonFunctions::imperialOrMetric;
use functions::increaseABV::{increaseABVData, finalSugarFloat, increaseABVMaths, increaseABVFormatting};
#[test]
fn increaseABVMathsImperialGBTest() {
......
use functions::commonFunctions::*;
use light::lightFunctions::*;
use functions::commonFunctions::grainToGravity;
use light::lightFunctions::{singleMCU, beerSRM, grainSRMToLAB, grainLABToXYZ, grainXYZToRGBA};
#[test]
fn singleMCUTest() {
......
use functions::commonFunctions::*;
use functions::commonFunctions::realABVAndAttenuation;
use functions::realABV::realABVFormatting;
#[test]
fn realABVMathsTest() {
let startingBrix = 21.0;
let finalBrix = 14.0;
let output = realABV(startingBrix, finalBrix);
let output = realABVAndAttenuation(startingBrix, finalBrix);
let abv = output.0;
let attenuation = output.1;
......
use functions::commonFunctions::*;
use functions::commonFunctions::realIBU;
#[test]
fn realIBUTest() {
......
use functions::commonFunctions::*;
use functions::waterSparge::*;
use functions::commonFunctions::{imperialOrMetric, singleInput};
use functions::waterSparge::{waterSpargeData, finalSpargeFloat, waterSpargeMaths, waterSpargeFormatting};
#[test]
fn waterSpargeMathsImperialGBTest() {
......
use functions::commonFunctions::*;
use functions::commonFunctions::zeroRGBA;
#[test]
fn zeroRGBATest() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment