Skip to content

Commit

Permalink
Moves Backtest class to subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Sep 9, 2024
1 parent 1f0d450 commit 9ad2adf
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/test-platform-backtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Test Platform/Backtest

env:
TEST_PATH: Platform/Backtest/tests
TEST_SKIP: ${{ secrets.MT5_LOGIN == '' }}

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- .github/workflows/test-platform-backtest.yml
- Platform/Backtest/**
push:
paths:
- .github/workflows/test-platform-backtest.yml
- Platform/Backtest/**

jobs:

compile:
name: Compile
uses: ./.github/workflows/compile-mql.yml
with:
artifact_prefix: mt
path: Platform/Backtest/tests
skip_cleanup: true

test:
defaults:
run:
shell: bash
working-directory: ${{ env.TEST_PATH }}
name: Test
needs: compile
runs-on: ubuntu-latest
strategy:
matrix:
test:
- Backtest.test
version: [5]
max-parallel: 4
steps:
- uses: actions/download-artifact@v4
with:
name: files-ex${{ matrix.version }}
- name: List compiled files
run: find . -name '*.ex?' -type f -print
- if: ${{ env.TEST_SKIP != true && env.TEST_SKIP != 'true' }}
name: Run ${{ matrix.test }}
uses: fx31337/mql-tester-action@master
with:
Login: ${{ secrets.MT5_LOGIN }}
Password: ${{ secrets.MT5_PASSWORD }}
Server: MetaQuotes-Demo
TestDeposit: 2000
TestExpert: ${{ matrix.test }}
TestFromDate: ${{ matrix.year }}.01.01
TestPeriod: M1
TestSymbol: EURUSD
TestToDate: ${{ matrix.year }}.01.14
# yamllint disable-line rule:line-length
UrlExpert: file://${{ github.workspace }}/${{ env.TEST_PATH }}/${{ matrix.test }}.ex${{ matrix.version }}
Version: 5
- if: ${{ failure() && runner.debug == '1' }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20

cleanup:
name: Clean-up
needs: [compile]
uses: ./.github/workflows/cleanup.yml
2 changes: 1 addition & 1 deletion Platform/Backtest.h → Platform/Backtest/Backtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#endif

// Includes.
#include "../EA.mqh"
#include "../../EA.mqh"

class Backtest {
protected:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

// Includes.
#include "../../Test.mqh"
#include "../../../Test.mqh"
#include "../Backtest.h"

// Test Backtest.
Expand Down
12 changes: 12 additions & 0 deletions Platform/Backtest/tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CC := g++ # C++ compiler
CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags
SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory
OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files

all: $(OBJS)

%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm -v $(OBJS)
1 change: 1 addition & 0 deletions tests/CompileTest.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct IndicatorParams;
#include "../Storage/Dict/Buffer/Buffer.h"
#include "../Storage/Dict/Buffer/BufferFXT.h"
#include "../Storage/Dict/Buffer/BufferStruct.h"
#include "../Platform/Backtest/Backtest.h"
#include "../Platform/Chart/Chart.h"
#include "../Config.mqh"
#include "../Convert.mqh"
Expand Down

0 comments on commit 9ad2adf

Please sign in to comment.