Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ on:
ios:
type: boolean
default: 'true'
web:
type: boolean
default: 'true'
device:
type: boolean
default: 'true'
linux:
type: boolean
default: 'true'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
MAKEFLAGS: ${{ (github.repository == 'numworks/epsilon-internal') && '-j32' || '-j2' }}
MAKEFLAGS: ${{ (github.repository == 'numworks/epsilon-internal') && '-j32' || '-j4' }}

jobs:
android:
Expand All @@ -43,6 +52,7 @@ jobs:
path: output/release/simulator/android/epsilon.apk
device:
runs-on: ${{ (github.repository == 'numworks/epsilon-internal') && 'self-hosted' || 'ubuntu-latest' }}
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.device == 'true' }}
strategy:
matrix:
model: [n0110, n0115, n0120]
Expand Down Expand Up @@ -99,6 +109,7 @@ jobs:
path: output/release/simulator/windows/epsilon.exe
web:
runs-on: ${{ (github.repository == 'numworks/epsilon-internal') && 'self-hosted' || 'ubuntu-latest' }}
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.web == 'true' }}
steps:
- uses: numworks/setup-emscripten@latest
with:
Expand All @@ -114,6 +125,7 @@ jobs:
retention-days: 7
linux:
runs-on: ${{ (github.repository == 'numworks/epsilon-internal') && 'self-hosted' || 'ubuntu-latest' }}
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.linux == 'true' }}
steps:
- uses: numworks/setup-llvm@latest
- uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion apps/apps_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,15 @@ bool AppsContainer::processEvent(Ion::Events::Event event) {
}
if (!Preferences::SharedPreferences()->examMode().isActive()) {
openDFU(true);
if (Preferences::SharedPreferences()->examMode().isActive()) {
Ion::USB::enable();
}
} else if (m_firstUSBEnumeration) {
displayExamModePopUp(ExamMode(ExamMode::Ruleset::Off));
m_firstUSBEnumeration = false;
// Warning: if the window is dirtied, you need to call window()->redraw()
window()->redraw();
}
m_firstUSBEnumeration = false;
return true;
}
if (event == Ion::Events::USBPlug) {
Expand Down Expand Up @@ -452,6 +455,7 @@ void AppsContainer::openDFU(bool blocking) {
} else if (preferences->examMode() != activeExamMode ||
preferences->forceExamModeReload()) {
setExamMode(preferences->examMode(), Ion::ExamMode::get());
m_firstUSBEnumeration = true;
}
// Update LED when exiting DFU mode
Ion::LED::updateColorWithPlugAndCharge();
Expand Down
7 changes: 4 additions & 3 deletions apps/calculation/test/calculation_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,10 @@ QUIZ_CASE(calculation_additional_results) {
assertCalculationAdditionalResultTypeHas("√(-1)", {}, &globalContext, &store);
assertCalculationAdditionalResultTypeHas("{1}", {}, &globalContext, &store);
assertCalculationAdditionalResultTypeHas("{i}", {}, &globalContext, &store);
/* TODO: Not working on windows
* assertCalculationAdditionalResultTypeHas("i^(2×e^(7i^(2×e^322)))", {},
* &globalContext, &store);*/
#ifndef PLATFORM_WINDOWS
assertCalculationAdditionalResultTypeHas("i^(2×e^(7i^(2×e^322)))", {},
&globalContext, &store);
#endif

assertCalculationAdditionalResultTypeHas("ln(3+4)", {}, &globalContext,
&store);
Expand Down
5 changes: 3 additions & 2 deletions apps/code/script_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ constexpr ScriptTemplate mandelbrotScriptTemplate(
import kandinsky
def mandelbrot(N_iteration):
for x in range(320):
for y in range(222):
for y in range(112):
# Compute the mandelbrot sequence for the point c = (c_r, c_i) with start value z = (z_r, z_i)
z = complex(0,0)
# Rescale to fit the drawing screen 320x222
Expand All @@ -40,7 +40,8 @@ def mandelbrot(N_iteration):
rgb = int(255*i/N_iteration)
col = kandinsky.color(int(rgb),int(rgb*0.75),int(rgb*0.25))
# Draw a pixel colored in 'col' at position (x,y)
kandinsky.set_pixel(x,y,col))");
kandinsky.set_pixel(x,y,col)
kandinsky.set_pixel(x,222-y,col))");

constexpr ScriptTemplate polynomialScriptTemplate("polynomial.py",
R"(from math import *
Expand Down
2 changes: 2 additions & 0 deletions apps/code/test/python_variable_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ void assert_variables_are(const char *script,
}

QUIZ_CASE(python_variable_box) {
#ifndef PLATFORM_WINDOWS
const char *expectedVariables[] = {"froo", "from", "frozenset()"};
// FIXME This test does not load imported variables for now
assert_variables_are("\x01 from math import *\nfroo=3", 21, 2,
expectedVariables, std::size(expectedVariables));
#endif
}
4 changes: 0 additions & 4 deletions apps/solver/list_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class ListController : public Shared::ExpressionModelListController,
Ion::Events::Event event) override;
void layoutFieldDidChangeSize(Escher::LayoutField* layoutField) override;
void layoutFieldDidAbortEditing(Escher::LayoutField* layoutField) override;
bool shouldInsertSingleQuoteInsteadOfDoubleQuotes(
Escher::LayoutField* layoutField) override {
return false;
}
bool isAcceptableExpression(const Poincare::Expression expression,
Poincare::Context* context) override;
/* ExpressionModelListController */
Expand Down
2 changes: 1 addition & 1 deletion build/config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PLATFORM ?= device
DEBUG ?= 0
DEVELOPMENT ?= 0

EPSILON_VERSION ?= 23.1.0
EPSILON_VERSION ?= 23.2.3
EXTERNAL_APPS_API_LEVEL ?= 0
EPSILON_APPS ?= calculation graph code statistics distributions inference solver sequence regression elements finance settings
EPSILON_GETOPT ?= 0
Expand Down
2 changes: 2 additions & 0 deletions build/platform.simulator.windows.mak
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ EXE = exe

EPSILON_TELEMETRY ?= 0
TERMS_OF_USE ?= 0

SFLAGS += -DPLATFORM_WINDOWS
4 changes: 0 additions & 4 deletions escher/include/escher/layout_field_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ class LayoutFieldDelegate : public ContextProvider {
Escher::LayoutField* layoutField) const {
return false;
}
virtual bool shouldInsertSingleQuoteInsteadOfDoubleQuotes(
LayoutField* layoutField) {
return true;
}
virtual void updateRepetitionIndexes(LayoutField* layoutField,
Ion::Events::Event event) {}
};
Expand Down
3 changes: 1 addition & 2 deletions escher/src/layout_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,7 @@ size_t LayoutField::getTextFromEvent(Ion::Events::Event event, char *buffer,
m_delegate->shouldInsertTextForAnsEvent(this)) {
return strlcpy(buffer, Symbol::k_ansAliases.mainAlias(), bufferSize);
}
if (event == Ion::Events::DoubleQuotes && m_delegate &&
m_delegate->shouldInsertSingleQuoteInsteadOfDoubleQuotes(this)) {
if (event == Ion::Events::DoubleQuotes) {
return SerializationHelper::CodePoint(buffer, bufferSize, '\'');
}
return Ion::Events::copyText(static_cast<uint8_t>(event), buffer, bufferSize);
Expand Down
2 changes: 1 addition & 1 deletion ion/src/device/epsilon-core
4 changes: 4 additions & 0 deletions poincare/include/poincare/input_beautification.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class InputBeautification {
return static_cast<Layout>(
CodePointLayout::Builder(UCodePointMultiplicationSign));
}},
{"''", 0,
[](Layout* parameters) {
return static_cast<Layout>(CodePointLayout::Builder('"'));
}},
};

constexpr static BeautificationRule k_infRule = {
Expand Down
3 changes: 2 additions & 1 deletion poincare/src/input_beautification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ InputBeautification::BeautificationMethodWhenInsertingLayout(
* = Do not apply any beautfication.
* Example: "pi|" -> insert "a" -> "pia|" (do not beautify "pi" yet)
* */
if (LayoutIsIdentifierMaterial(leftMostLayout)) {
if (LayoutIsIdentifierMaterial(leftMostLayout) &&
static_cast<CodePointLayout &>(leftMostLayout).codePoint() != '\'') {
return BeautificationMethod{.beautifyIdentifiersBeforeInserting = false,
.beautifyAfterInserting = false};
}
Expand Down
5 changes: 5 additions & 0 deletions poincare/test/approximation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1125,12 +1125,15 @@ QUIZ_CASE(poincare_approximation_trigonometry_functions) {
assert_expression_approximates_to<double>("1/cot(π/2)", Undefined::Name(),
Radian);
// tan(almost π/2)
#ifndef PLATFORM_WINDOWS
assert_expression_approximates_to<double>("tan(1.57079632)",
"147169276.57047", Radian);
assert_expression_approximates_to<double>("sin(1.57079632)/cos(1.57079632)",
"147169276.57047", Radian);
assert_expression_approximates_to<double>("1/cot(1.57079632)",
"147169276.57047", Radian);
#endif

// Advanced function : cot
assert_expression_approximates_to<double>("cot(2)", "-0.45765755436029",
Radian);
Expand All @@ -1145,13 +1148,15 @@ QUIZ_CASE(poincare_approximation_trigonometry_functions) {
Radian);
assert_expression_approximates_to<double>("cos(π/2)/sin(π/2)", "0", Radian);
assert_expression_approximates_to<double>("cot(π/2)", "0", Radian);
#ifndef PLATFORM_WINDOWS
// cot(almost π/2)
assert_expression_approximates_to<double>("1/tan(1.57079632)",
"6.7948964845335ᴇ-9", Radian);
assert_expression_approximates_to<double>("cos(1.57079632)/sin(1.57079632)",
"6.7948964845335ᴇ-9", Radian);
assert_expression_approximates_to<double>("cot(1.57079632)",
"6.7948964845335ᴇ-9", Radian);
#endif

/* acos: [-1,1] -> R
* ]-inf,-1[ -> π+R×i (odd imaginary)
Expand Down
2 changes: 2 additions & 0 deletions python/test/basics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ QUIZ_CASE(python_template) {
}

QUIZ_CASE(python_fixes) {
#ifndef PLATFORM_WINDOWS
TestExecutionEnvironment env = init_environement();
assert_command_execution_fails(env, "'abcd'*2**62");
deinit_environment();
#endif
}
4 changes: 4 additions & 0 deletions python/test/ion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "execution_environment.h"

QUIZ_CASE(python_ion_import) {
#ifndef PLATFORM_WINDOWS
// Test "from ion import *"
TestExecutionEnvironment env = init_environement();
assert_command_execution_fails(env, "keydown(KEY_LEFT)");
Expand All @@ -16,11 +17,14 @@ QUIZ_CASE(python_ion_import) {
assert_command_execution_succeeds(env, "import ion");
assert_command_execution_succeeds(env, "ion.keydown(ion.KEY_LEFT)");
deinit_environment();
#endif
}

QUIZ_CASE(python_ion_keydown) {
#ifndef PLATFORM_WINDOWS
TestExecutionEnvironment env = init_environement();
assert_command_execution_succeeds(env, "from ion import *");
assert_command_execution_succeeds(env, "keydown(KEY_LEFT)", "False\n");
deinit_environment();
#endif
}
4 changes: 4 additions & 0 deletions python/test/kandinsky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "execution_environment.h"

QUIZ_CASE(python_kandinsky_import) {
#ifndef PLATFORM_WINDOWS
// Test "from kandinsky import *"
TestExecutionEnvironment env = init_environement();
assert_command_execution_fails(env, "get_pixel(0,0)");
Expand All @@ -16,14 +17,17 @@ QUIZ_CASE(python_kandinsky_import) {
assert_command_execution_succeeds(env, "import kandinsky");
assert_command_execution_succeeds(env, "kandinsky.get_pixel(0,0)");
deinit_environment();
#endif
}

QUIZ_CASE(python_kandinsky_basics) {
#ifndef PLATFORM_WINDOWS
TestExecutionEnvironment env = init_environement();
assert_command_execution_succeeds(env, "from kandinsky import *");
assert_command_execution_succeeds(env, "set_pixel(0,0,color(12,12,12))");
assert_command_execution_succeeds(env, "get_pixel(0,0)");
assert_command_execution_succeeds(env, "fill_rect(0,0,10,10,color(2,3,2))");
assert_command_execution_succeeds(env, "draw_string('hello',0,0)");
deinit_environment();
#endif
}
4 changes: 4 additions & 0 deletions python/test/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "execution_environment.h"

QUIZ_CASE(python_math) {
#ifndef PLATFORM_WINDOWS
TestExecutionEnvironment env = init_environement();
assert_command_execution_succeeds(env, "from math import *");
assert_command_execution_succeeds(env, "e", "2.718281828459045\n");
Expand Down Expand Up @@ -59,9 +60,11 @@ QUIZ_CASE(python_math) {
"9000000009000000009\n");
assert_command_execution_succeeds(env, "gcd()", "0\n");
deinit_environment();
#endif
}

QUIZ_CASE(python_cmath) {
#ifndef PLATFORM_WINDOWS
TestExecutionEnvironment env = init_environement();
assert_command_execution_succeeds(env, "from cmath import *");
assert_command_execution_succeeds(env, "cos(0)", "(1+-0j)\n");
Expand All @@ -88,4 +91,5 @@ QUIZ_CASE(python_cmath) {
*/
// clang-format on
deinit_environment();
#endif
}
Loading