mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[solver] Display warning when one of the variable name exceeds 10
characters
This commit is contained in:
@@ -14,7 +14,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
Poincare::Expression standardForm(Poincare::Context * context) const;
|
||||
constexpr static int k_maxVariableSize = 10;
|
||||
constexpr static int k_maxVariableSize = 11;
|
||||
private:
|
||||
void tidyStandardForm();
|
||||
mutable Poincare::Expression m_standardForm;
|
||||
|
||||
@@ -111,9 +111,9 @@ EquationStore::Error EquationStore::exactSolve(Poincare::Context * context) {
|
||||
if (numberOfVariables == -1) {
|
||||
return Error::TooManyVariables;
|
||||
}
|
||||
/*if (numberOfVariables == -2) {
|
||||
if (numberOfVariables == -2) {
|
||||
return Error::VariableNameTooLong;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/* 1- Linear System? */
|
||||
|
||||
@@ -19,7 +19,8 @@ public:
|
||||
EquationUndefined = -1,
|
||||
TooManyVariables = -2,
|
||||
NonLinearSystem = -3,
|
||||
RequireApproximateSolution = -4
|
||||
RequireApproximateSolution = -4,
|
||||
VariableNameTooLong
|
||||
};
|
||||
/* EquationStore */
|
||||
EquationStore();
|
||||
|
||||
@@ -179,6 +179,9 @@ void ListController::resolveEquations() {
|
||||
case EquationStore::Error::TooManyVariables:
|
||||
app()->displayWarning(I18n::Message::TooManyVariables);
|
||||
return;
|
||||
case EquationStore::Error::VariableNameTooLong:
|
||||
app()->displayWarning(I18n::Message::VariableNameTooLong);
|
||||
return;
|
||||
case EquationStore::Error::NonLinearSystem:
|
||||
app()->displayWarning(I18n::Message::NonLinearSystem);
|
||||
return;
|
||||
|
||||
@@ -73,6 +73,10 @@ QUIZ_CASE(equation_solve) {
|
||||
const char * equations0[] = {"x+y+z+a+b+c+d=0", 0};
|
||||
assert_equation_system_exact_solve_to(equations0, EquationStore::Error::TooManyVariables, EquationStore::Type::LinearSystem, {""}, nullptr, 0);
|
||||
|
||||
// x+y+z+a+b+c+d = 0
|
||||
const char * equations01[] = {"tototototot=0", 0};
|
||||
assert_equation_system_exact_solve_to(equations0, EquationStore::Error::VariableNameTooLong, EquationStore::Type::VariableNameTooLong, {""}, nullptr, 0);
|
||||
|
||||
// x^2+y = 0
|
||||
const char * equations1[] = {"x^2+y=0", 0};
|
||||
assert_equation_system_exact_solve_to(equations1, EquationStore::Error::NonLinearSystem, EquationStore::Type::LinearSystem, {""}, nullptr, 0);
|
||||
|
||||
Reference in New Issue
Block a user