Compare commits
1 Commits
docs-dates
...
llm_test/a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff5be2f544 |
@@ -876,6 +876,8 @@ fn get_function_args_signature(kind: &Function, arg_count: usize) -> Vec<Signatu
|
||||
Function::Sheets => args_signature_scalars(arg_count, 0, 1),
|
||||
Function::Cell => args_signature_scalars(arg_count, 1, 1),
|
||||
Function::Info => args_signature_scalars(arg_count, 1, 1),
|
||||
Function::Accrint => args_signature_scalars(arg_count, 6, 2),
|
||||
Function::Accrintm => args_signature_scalars(arg_count, 4, 1),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,5 +1141,7 @@ fn static_analysis_on_function(kind: &Function, args: &[Node]) -> StaticResult {
|
||||
Function::Sheets => scalar_arguments(args),
|
||||
Function::Cell => scalar_arguments(args),
|
||||
Function::Info => scalar_arguments(args),
|
||||
Function::Accrint => scalar_arguments(args),
|
||||
Function::Accrintm => scalar_arguments(args),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1830,4 +1830,14 @@ impl Model {
|
||||
|
||||
CalcResult::Number(rate * (cost - result))
|
||||
}
|
||||
|
||||
// ACCRINT(issue, first_interest, settlement, rate, par, frequency, [basis], [calc_method])
|
||||
pub(crate) fn fn_accrint(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
||||
todo!()
|
||||
}
|
||||
|
||||
// ACCRINTM(issue, settlement, rate, par, [basis])
|
||||
pub(crate) fn fn_accrintm(&mut self, args: &[Node], cell: CellReferenceIndex) -> CalcResult {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +217,8 @@ pub enum Function {
|
||||
Isoweeknum,
|
||||
|
||||
// Financial
|
||||
Accrint,
|
||||
Accrintm,
|
||||
Cumipmt,
|
||||
Cumprinc,
|
||||
Db,
|
||||
@@ -313,7 +315,7 @@ pub enum Function {
|
||||
}
|
||||
|
||||
impl Function {
|
||||
pub fn into_iter() -> IntoIter<Function, 256> {
|
||||
pub fn into_iter() -> IntoIter<Function, 258> {
|
||||
[
|
||||
Function::And,
|
||||
Function::False,
|
||||
@@ -571,6 +573,8 @@ impl Function {
|
||||
Function::Cell,
|
||||
Function::Info,
|
||||
Function::Sheets,
|
||||
Function::Accrint,
|
||||
Function::Accrintm,
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
@@ -908,6 +912,8 @@ impl Function {
|
||||
"CELL" => Some(Function::Cell),
|
||||
"INFO" => Some(Function::Info),
|
||||
"SHEETS" | "_XLFN.SHEETS" => Some(Function::Sheets),
|
||||
"ACCRINT" => Some(Function::Accrint),
|
||||
"ACCRINTM" => Some(Function::Accrintm),
|
||||
|
||||
_ => None,
|
||||
}
|
||||
@@ -1174,6 +1180,9 @@ impl fmt::Display for Function {
|
||||
Function::Cell => write!(f, "CELL"),
|
||||
Function::Info => write!(f, "INFO"),
|
||||
Function::Sheets => write!(f, "SHEETS"),
|
||||
|
||||
Function::Accrint => write!(f, "ACCRINT"),
|
||||
Function::Accrintm => write!(f, "ACCRINTM"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1458,6 +1467,8 @@ impl Model {
|
||||
Function::Cell => self.fn_cell(args, cell),
|
||||
Function::Info => self.fn_info(args, cell),
|
||||
Function::Sheets => self.fn_sheets(args, cell),
|
||||
Function::Accrint => self.fn_accrint(args, cell),
|
||||
Function::Accrintm => self.fn_accrintm(args, cell),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ mod test_number_format;
|
||||
mod test_arrays;
|
||||
mod test_escape_quotes;
|
||||
mod test_extend;
|
||||
mod test_fn_accrint;
|
||||
mod test_fn_fv;
|
||||
mod test_fn_round;
|
||||
mod test_fn_type;
|
||||
|
||||
23
base/src/test/test_fn_accrint.rs
Normal file
23
base/src/test/test_fn_accrint.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
#![allow(clippy::unwrap_used)]
|
||||
|
||||
use crate::test::util::new_empty_model;
|
||||
|
||||
#[test]
|
||||
fn fn_average_accrint_simple_cases() {
|
||||
let mut model = new_empty_model();
|
||||
// ACCRINT(issue, first_interest, settlement, rate, par, frequency, [basis], [calc_method])
|
||||
model._set("A1", "=ACCRINT(39508, 39691, 39569, 0.1, 1000, 2, 0)");
|
||||
model._set(
|
||||
"A2",
|
||||
"=ACCRINT(DATE(2008, 3, 5), 39691, 39569, 0.1, 1000, 2, 0, FALSE)",
|
||||
);
|
||||
model._set(
|
||||
"A3",
|
||||
"=ACCRINT(DATE(2008, 4, 5), 39691, 39569, 0.1, 1000, 2, 0, TRUE)",
|
||||
);
|
||||
model.evaluate();
|
||||
|
||||
assert_eq!(model._get_text("A1"), *"16.666666667");
|
||||
assert_eq!(model._get_text("A2"), *"15.555555556");
|
||||
assert_eq!(model._get_text("A3"), *"7.222222222");
|
||||
}
|
||||
BIN
xlsx/tests/calc_tests/ACCRINT_ACCRINTM.xlsx
Normal file
BIN
xlsx/tests/calc_tests/ACCRINT_ACCRINTM.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user