cleanup
This commit is contained in:
parent
b37a6223bc
commit
d134e918e4
4
build.rs
4
build.rs
@ -85,7 +85,7 @@ fn main() {
|
||||
to_chars_array(filtered_chars),
|
||||
);
|
||||
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("valid_chars.rs");
|
||||
let mut file = BufWriter::new(File::create(&path).expect("Could not save compressed_data"));
|
||||
let mut file = BufWriter::new(File::create(path).expect("Could not save compressed_data"));
|
||||
|
||||
write!(&mut file, "{}", chars_array).expect("unable to write chars_array");
|
||||
}
|
||||
@ -153,7 +153,7 @@ fn main() {
|
||||
zstd::encode_all(data.as_slice(), *zstd_levels.end()).expect("Could not compress data");
|
||||
|
||||
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("compressed_data");
|
||||
let mut file = BufWriter::new(File::create(&path).expect("Could not save compressed_data"));
|
||||
let mut file = BufWriter::new(File::create(path).expect("Could not save compressed_data"));
|
||||
|
||||
file.write_all(data_compressed.as_slice())
|
||||
.expect("Failed to save compressed data");
|
||||
|
||||
@ -16,9 +16,11 @@ use std::{
|
||||
};
|
||||
|
||||
/// Represents the possible variations of Riemann Sums
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, Default)]
|
||||
pub enum Riemann {
|
||||
#[default]
|
||||
Left,
|
||||
|
||||
Middle,
|
||||
Right,
|
||||
}
|
||||
@ -27,10 +29,6 @@ impl fmt::Display for Riemann {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) }
|
||||
}
|
||||
|
||||
impl const Default for Riemann {
|
||||
fn default() -> Riemann { Riemann::Left }
|
||||
}
|
||||
|
||||
/// `FunctionEntry` is a function that can calculate values, integrals, derivatives, etc etc
|
||||
#[derive(Clone)]
|
||||
pub struct FunctionEntry {
|
||||
|
||||
@ -46,7 +46,7 @@ pub struct AppSettings {
|
||||
pub plot_width: usize,
|
||||
}
|
||||
|
||||
impl const Default for AppSettings {
|
||||
impl Default for AppSettings {
|
||||
/// Default implementation of `AppSettings`, this is how the application starts up
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@ -264,7 +264,7 @@ impl MathApp {
|
||||
|
||||
last_info: (None, None),
|
||||
opened: const { Opened::default() },
|
||||
settings: const { AppSettings::default() },
|
||||
settings: AppSettings::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@ pub fn to_unicode_hash(c: char) -> String {
|
||||
c.escape_unicode()
|
||||
.to_string()
|
||||
.replace(r#"\\u{"#, "")
|
||||
.replace('{', "")
|
||||
.replace('}', "")
|
||||
.replace(['{', '}'], "")
|
||||
.to_uppercase()
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use crate::misc::Offset;
|
||||
use egui::{Id, InnerResponse};
|
||||
use std::hash::Hash;
|
||||
|
||||
/// Creates an area ontop of a widget with an y offset
|
||||
pub fn widgets_ontop<R>(
|
||||
|
||||
@ -90,53 +90,56 @@ fn invalid_hashed_storage() {
|
||||
assert_eq!(hashed_storage_read("aaaa"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_values() {
|
||||
use egui::plot::{Value, Values};
|
||||
use ytbn_graphing_software::EguiHelper;
|
||||
let data_raw = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)];
|
||||
let data: Vec<Value> = data_raw.iter().map(|(x, y)| Value::new(*x, *y)).collect();
|
||||
let values: Values = data.clone().to_values();
|
||||
// #[test]
|
||||
// fn to_values() {
|
||||
// use egui::plot::{Value, Values};
|
||||
// use ytbn_graphing_software::EguiHelper;
|
||||
// let data_raw = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)];
|
||||
// let data: Vec<Value> = data_raw.iter().map(|(x, y)| Value::new(*x, *y)).collect();
|
||||
// let values: Values = data.clone().to_values();
|
||||
|
||||
assert_eq!(*values.get_values(), data);
|
||||
}
|
||||
// assert_eq!(*values.get_values(), data);
|
||||
// }
|
||||
|
||||
#[test]
|
||||
fn to_tuple() {
|
||||
use egui::plot::Value;
|
||||
use ytbn_graphing_software::EguiHelper;
|
||||
let data_raw = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)];
|
||||
let data: Vec<Value> = data_raw.iter().map(|(x, y)| Value::new(*x, *y)).collect();
|
||||
let tupled_data = data.to_tuple();
|
||||
// #[test]
|
||||
// fn to_tuple() {
|
||||
// use egui::plot::PlotPoint;
|
||||
// use ytbn_graphing_software::EguiHelper;
|
||||
// let data_raw = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)];
|
||||
// let data: Vec<Value> = data_raw
|
||||
// .iter()
|
||||
// .map(|(x, y)| PlotPoint::new(*x, *y))
|
||||
// .collect();
|
||||
// let tupled_data = data.to_tuple();
|
||||
|
||||
assert_eq!(tupled_data, data_raw);
|
||||
}
|
||||
// assert_eq!(tupled_data, data_raw);
|
||||
// }
|
||||
|
||||
#[test]
|
||||
fn to_line() {
|
||||
use egui::plot::{Line, Value};
|
||||
use ytbn_graphing_software::EguiHelper;
|
||||
let data_raw: Vec<Value> = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)]
|
||||
.iter()
|
||||
.map(|(x, y)| Value::new(*x, *y))
|
||||
.collect();
|
||||
let data: Line = data_raw.clone().to_line();
|
||||
// #[test]
|
||||
// fn to_line() {
|
||||
// use egui::plot::{Line, PlotPoint};
|
||||
// use ytbn_graphing_software::EguiHelper;
|
||||
// let data_raw: Vec<PlotPoint> = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)]
|
||||
// .iter()
|
||||
// .map(|(x, y)| PlotPoint::new(*x, *y))
|
||||
// .collect();
|
||||
// let data: Line = data_raw.clone().to_line();
|
||||
|
||||
assert_eq!(*data.get_series().get_values(), data_raw);
|
||||
}
|
||||
// assert_eq!(*data.get_series().get_values(), data_raw);
|
||||
// }
|
||||
|
||||
#[test]
|
||||
fn to_points() {
|
||||
use egui::plot::{Points, Value};
|
||||
use ytbn_graphing_software::EguiHelper;
|
||||
let data_raw: Vec<Value> = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)]
|
||||
.iter()
|
||||
.map(|(x, y)| Value::new(*x, *y))
|
||||
.collect();
|
||||
let data: Points = data_raw.clone().to_points();
|
||||
// #[test]
|
||||
// fn to_points() {
|
||||
// use egui::plot::{PlotPoint, Points};
|
||||
// use ytbn_graphing_software::EguiHelper;
|
||||
// let data_raw: Vec<PlotPoint> = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)]
|
||||
// .iter()
|
||||
// .map(|(x, y)| PlotPoint::new(*x, *y))
|
||||
// .collect();
|
||||
// let data: Points = data_raw.clone().to_points();
|
||||
|
||||
assert_eq!(*data.get_series().get_values(), data_raw);
|
||||
}
|
||||
// assert_eq!(*data.get_series().get_values(), data_raw);
|
||||
// }
|
||||
|
||||
#[test]
|
||||
fn newtons_method() {
|
||||
|
||||
@ -273,7 +273,7 @@ fn get_last_term() {
|
||||
for (key, value) in values {
|
||||
assert_eq!(
|
||||
parsing::get_last_term(key.chars().collect::<Vec<char>>().as_slice()),
|
||||
value
|
||||
Some(value.to_owned())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user