|
18 | 18 | env: |
19 | 19 | MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }} |
20 | 20 |
|
21 | | - - name: Exercise RunMATLABCommand |
| 21 | + - name: Greet the world in style |
22 | 22 | uses: ./ |
23 | 23 | with: |
24 | 24 | command: "disp('hello world');" |
| 25 | + |
| 26 | + - name: Run MATLAB statement |
| 27 | + uses: ./ |
| 28 | + with: |
| 29 | + command: f = fopen('myscript.m', 'w'); fwrite(f, 'assert(true)'); fclose(f); |
| 30 | + |
| 31 | + - name: Run MATLAB script |
| 32 | + uses: ./ |
| 33 | + with: |
| 34 | + command: myscript |
| 35 | + |
| 36 | + - name: Run MATLAB statement with quotes 1 |
| 37 | + uses: ./ |
| 38 | + with: |
| 39 | + command: "eval(\"a = 1+2\"), assert(a == 3); eval('b = 3+4'), assert(b == 7);" |
| 40 | + |
| 41 | + - name: Run MATLAB statement with quotes 2 |
| 42 | + uses: ./ |
| 43 | + with: |
| 44 | + command: 'eval("a = 1+2"), assert(a == 3); eval(''b = 3+4''), assert(b == 7);' |
| 45 | + |
| 46 | + - name: Run MATLAB statement with quotes 3 |
| 47 | + uses: ./ |
| 48 | + with: |
| 49 | + command: a = """hello world""", b = '"hello world"', assert(strcmp(a,b)); |
| 50 | + |
| 51 | + - name: Run MATLAB statement with symbols |
| 52 | + uses: ./ |
| 53 | + with: |
| 54 | + command: a = " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~", b = char([32:126]), assert(strcmp(a, b), a+b); |
| 55 | + |
| 56 | + - name: Run MATLAB statement in working directory |
| 57 | + uses: ./ |
| 58 | + with: |
| 59 | + command: exp = getenv('GITHUB_WORKSPACE'), act = pwd, assert(strcmp(act, exp), strjoin({act exp}, '\n')); |
| 60 | + |
| 61 | + - run: echo 'onetyone = 11' > startup.m |
| 62 | + shell: bash |
| 63 | + |
| 64 | + - name: MATLAB runs startup.m automatically |
| 65 | + uses: ./ |
| 66 | + with: |
| 67 | + command: assert(onetyone==11, 'the variable `onetyone` was not set as expected by startup.m') |
0 commit comments