From 18a4868cbd826347c878950cc5ce1b92fc76e6a3 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Wed, 14 Nov 2018 12:54:26 -0800 Subject: [PATCH] Adding blocks tests (#1620) * Adding blocks tests * Moving block tests * Adding chromium to travis yml --- .travis.yml | 6 +- libs/core/blocks-test/basic.blocks | 53 +++ libs/core/blocks-test/control.blocks | 66 +++ libs/core/blocks-test/game.blocks | 183 ++++++++ libs/core/blocks-test/image.blocks | 46 ++ libs/core/blocks-test/input.blocks | 132 ++++++ libs/core/blocks-test/led.blocks | 115 +++++ libs/core/blocks-test/music.blocks | 95 ++++ libs/core/blocks-test/pins.blocks | 210 +++++++++ libs/core/blocks-test/serial.blocks | 94 ++++ libs/core/blocks-test/test.blocks | 677 +++++++++++++++++++++++++++ 11 files changed, 1676 insertions(+), 1 deletion(-) create mode 100644 libs/core/blocks-test/basic.blocks create mode 100644 libs/core/blocks-test/control.blocks create mode 100644 libs/core/blocks-test/game.blocks create mode 100644 libs/core/blocks-test/image.blocks create mode 100644 libs/core/blocks-test/input.blocks create mode 100644 libs/core/blocks-test/led.blocks create mode 100644 libs/core/blocks-test/music.blocks create mode 100644 libs/core/blocks-test/pins.blocks create mode 100644 libs/core/blocks-test/serial.blocks create mode 100644 libs/core/blocks-test/test.blocks diff --git a/.travis.yml b/.travis.yml index aaa77a7f..088bff3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ language: node_js node_js: - "8.9.4" +before_install: + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start script: - - "node node_modules/pxt-core/built/pxt.js travis" + - "node node_modules/pxt-core/built/pxt.js travis" # - "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js run)" # - "(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js run)" # - "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)" diff --git a/libs/core/blocks-test/basic.blocks b/libs/core/blocks-test/basic.blocks new file mode 100644 index 00000000..3fd21664 --- /dev/null +++ b/libs/core/blocks-test/basic.blocks @@ -0,0 +1,53 @@ + + + receivedNumber + + + + + + + 12 + + + + + IconNames.Umbrella + + + + + Hello! + + + + + + + 100 + + + + + + + + + ArrowNames.South + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/control.blocks b/libs/core/blocks-test/control.blocks new file mode 100644 index 00000000..5f6f4363 --- /dev/null +++ b/libs/core/blocks-test/control.blocks @@ -0,0 +1,66 @@ + + + item + + + + + + + + + 4 + + + + + + + + EventBusSource.MICROBIT_ID_BUTTON_A + + + + + + EventBusValue.MICROBIT_EVT_ANY + + + + + + + + + + + + + + EventBusSource.MICROBIT_ID_BUTTON_A + + + EventBusValue.MES_DPAD_BUTTON_C_UP + + + + + EventBusValue.MICROBIT_EVT_ANY + + + EventBusValue.MES_REMOTE_CONTROL_EVT_PLAY + + + + + item + + + 0 + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/game.blocks b/libs/core/blocks-test/game.blocks new file mode 100644 index 00000000..9b8ede84 --- /dev/null +++ b/libs/core/blocks-test/game.blocks @@ -0,0 +1,183 @@ + + + item + gdfgsdfg + + + + + + + + + 2 + + + + + 2 + + + + + + + + + item + + + + + 1 + + + + + Direction.Right + + + item + + + + + 45 + + + + + LedSpriteProperty.X + + + item + + + + + 1 + + + + + LedSpriteProperty.X + + + item + + + + + 0 + + + LedSpriteProperty.X + + + item + + + + + + + gdfgsdfg + + + 0 + + + + + item + + + + + item + + + + + + + gdfgsdfg + + + 0 + + + + + item + + + + + + + + + item + + + + + + + 1 + + + + + + + + 0 + + + + + + + 10000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + item + + + 0 + + + + + item + + \ No newline at end of file diff --git a/libs/core/blocks-test/image.blocks b/libs/core/blocks-test/image.blocks new file mode 100644 index 00000000..a6272f28 --- /dev/null +++ b/libs/core/blocks-test/image.blocks @@ -0,0 +1,46 @@ + + + item + + + + + + + IconNames.Heart + + + + + 0 + + + ArrowNames.South + + + + + + + ArrowNames.SouthWest + + + + + 1 + + + + + 200 + + + + + + + + + item + + \ No newline at end of file diff --git a/libs/core/blocks-test/input.blocks b/libs/core/blocks-test/input.blocks new file mode 100644 index 00000000..dce61b60 --- /dev/null +++ b/libs/core/blocks-test/input.blocks @@ -0,0 +1,132 @@ + + + item + sdfsadf + + + Button.AB + + + item + + + 0 + + + Button.B + + + + + item + + + 0 + + + TouchPin.P1 + + + + + sdfsadf + + + 0 + + + Dimension.Y + + + + + sdfsadf + + + 0 + + + + + + sdfsadf + + + 0 + + + + + + sdfsadf + + + 0 + + + + + + sdfsadf + + + 0 + + + Rotation.Roll + + + + + sdfsadf + + + 0 + + + Dimension.Z + + + + + sdfsadf + + + 0 + + + + + + AcceleratorRange.TwoG + + + + + + + + + + + + + + + + + + + + + + + Gesture.SixG + + + TouchPin.P2 + + + TouchPin.P2 + + \ No newline at end of file diff --git a/libs/core/blocks-test/led.blocks b/libs/core/blocks-test/led.blocks new file mode 100644 index 00000000..681bc93b --- /dev/null +++ b/libs/core/blocks-test/led.blocks @@ -0,0 +1,115 @@ + + + + + + + + 5 + + + + + 5 + + + + + + + 5 + + + + + 5 + + + + + + + 5 + + + + + 5 + + + + + + + 0 + + + + + 0 + + + + + + + 5 + + + + + 5 + + + + + + 5 + + + + + + + 5 + + + + + + + + + FALSE + + + + + 5 + + + + + 5 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/music.blocks b/libs/core/blocks-test/music.blocks new file mode 100644 index 00000000..59ba38fb --- /dev/null +++ b/libs/core/blocks-test/music.blocks @@ -0,0 +1,95 @@ + + + item + + + MusicEvent.BackgroundMelodyStarted + + + + + 175 + + + + + BeatFraction.Sixteenth + + + + + + + 147 + + + + + + + BeatFraction.Sixteenth + + + + + item + + + 0 + + + 466 + + + + + item + + + 0 + + + BeatFraction.Sixteenth + + + + + item + + + 0 + + + + + + + + 1242 + + + + + + + 5 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/pins.blocks b/libs/core/blocks-test/pins.blocks new file mode 100644 index 00000000..fe5a05ae --- /dev/null +++ b/libs/core/blocks-test/pins.blocks @@ -0,0 +1,210 @@ + + + + DigitalPin.P5 + PulseValue.Low + + + AnalogPin.P9 + + + 5 + + + + + AnalogPin.P10 + + + 20000 + + + + + DigitalPin.P6 + + + 5 + + + + + AnalogPin.P13 + + + 5 + + + + + AnalogPin.P8 + + + 1500 + + + + + 0 + + + NumberFormat.Int8BE + + + 0 + + + + + FALSE + + + + + + + 0 + + + DigitalPin.P9 + PulseValue.Low + + + + + 1023 + + + + + + 0 + + + + + 0 + + + + + + + 4 + + + + + + + NumberFormat.Int16BE + + + 0 + + + DigitalPin.P9 + + + + + 0 + + + AnalogPin.P9 + + + + + FALSE + + + + + DigitalPin.P11 + DigitalPin.P9 + DigitalPin.P10 + + + DigitalPin.P9 + PinPullMode.PullDown + + + + + 0 + + + + + 0 + + + + + DigitalPin.P8 + PinEventType.Touch + + + AnalogPin.P9 + + + + + 8 + + + + + 3 + + + + + + + 8 + + + + + 3 + + + + + + + 1000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/serial.blocks b/libs/core/blocks-test/serial.blocks new file mode 100644 index 00000000..f1edf86c --- /dev/null +++ b/libs/core/blocks-test/serial.blocks @@ -0,0 +1,94 @@ + + + item + + + + + Delimiters.Colon + + + + + + + + + + + + + + + + 0 + + + + + + + x + + + + + Delimiters.Colon + + + + + + + 0 + + + + + + + + + + + + + + item + + + + + SerialPin.P12 + SerialPin.P13 + BaudRate.BaudRate28800 + + + + + + + 64 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/core/blocks-test/test.blocks b/libs/core/blocks-test/test.blocks new file mode 100644 index 00000000..f39ac5a0 --- /dev/null +++ b/libs/core/blocks-test/test.blocks @@ -0,0 +1,677 @@ + + + booltest + myImage + strtest + + + + + + + 123 + + + + + + ` + # . . # . + # . . # . + . # . . . + . # # . . + . . . . . + ` + + + + IconNames.Heart + + + + + 500 + + + + + + + + + ArrowNames.SouthEast + + + + + + + myImage + + + + + 0 + + + + + + + myImage + + + + + 1 + + + + + + 200 + + + + + strtest + + + 0 + + + + + Delimiters.Hash + + + + + + + strtest + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + TouchPin.P2 + + + + + + 1 + + + + + + 2 + + + + + + + 5 + + + + + 45 + + + + + DisplayMode.Greyscale + + + AnalogPin.P4 + + + + 1023 + + + AnalogPin.P13 + + + + + DigitalPin.P10 + + + + 0 + + + DigitalPin.P15 + + + + + AnalogPin.P9 + + + 1234 + + + + + 0 + + + + + + 0 + + + + + + 1023 + + + Rotation.Roll + + + + + 0 + + + Dimension.Y + + + + + 4 + + + + + + + + AnalogPin.P20 + + + + 180 + + + Dimension.Z + + + + + AnalogPin.P14 + + + 1500 + + + + + + + + 220 + + + + + BeatFraction.Sixteenth + + + + + + + 659 + + + + + + + BeatFraction.Double + + + + + MelodyOptions.ForeverInBackground + + + Melodies.Ringtone + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gesture.TiltLeft + + + + + + 1 + + + EventBusValue.MICROBIT_PIN_EVT_PULSE_HI + + + + + + 2 + + + + + + + + + 64 + + + + + + + + + + + + + booltest + + + 0 + + + Button.B + + + + + booltest + + + 0 + + + TouchPin.P2 + + + + + booltest + + + 0 + + + + + + 3 + + + + + + 4 + + + + + + + + + + + + + Button.AB + + + + + + 1 + + + BeatFraction.Sixteenth + + + + + + 2 + + + + + + + + 3 + + + + + + + 5 + + + + + + 255 + + + + + + + + + 255 + + + 440 + + + + + + + + + TRUE + + + + + + + + + + + + + + + + + + + + + + 4 + + + + + + + + EventBusSource.MICROBIT_ID_IO_P0 + + + + + EventBusValue.MES_ALERT_EVT_ALARM1 + + + + + + + + + TouchPin.P2 + + + AcceleratorRange.EightG + + + + + + + Delimiters.Colon + + + + + SerialPin.P12 + SerialPin.P14 + BaudRate.BaudRate19200 + + + + + + + + DigitalPin.P10 + PulseValue.Low + + + NumberFormat.UInt8BE + + + 0 + + + + + 0 + + + + + FALSE + + + + + + + 0 + + + + + 0 + + + + + DigitalPin.P0 + PinEventType.Touch + + + + + 1000000 + + + + + AnalogPin.P2 + + + DigitalPin.P2 + PinPullMode.PullDown + + + + + 8 + + + + + 3 + + + + + DigitalPin.P9 + DigitalPin.P14 + DigitalPin.P16 + + + + + + + + + + + + + + + + + + + + + + MusicEvent.BackgroundMelodyNotePlayed + + + + + 123 + + + + + + + + 12312312 + + + + + + + + + + + + + + + 0 + + + + + + + x + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + EventBusSource.MICROBIT_ID_IO_P1 + + + + + EventBusValue.MES_ALERT_EVT_ALARM2 + + + + \ No newline at end of file