WASDEV(The AI WorkShop)Docs Website Download

Chapter 1 · GAD language

Tests, projects and packages

Write tests in GAD, declare a project with lakou.gad, start every GAD target from the Run panel and add packages.

Write and run tests

A test is an action whose name starts with tès-, in a file whose name starts with tès.

fè kare ak n
    retounen n * n
fini

fè tès-kare
    asire-egal(kare(3), 9)
fini

fè tès-lis
    asire-egal(longè([1, 2, 3]), 3)
    asire(triye([3, 1, 2])[0] se 1, "premye a dwe 1")
fini
The tests in the WASDEV terminal
The tests in the WASDEV terminal
  1. Create the file tès-kalkil.gad with this code.
  2. Type gad tès in the terminal. GAD runs every test of every test file of the folder.
── tès-kalkil.gad
  ✓ tès-kare
  ✓ tès-lis
  2 pase, 0 echwe
  • asire-egal(a, b) stops when a is not equal to b, and says what it expected and what it found.
  • The exit code is 1 when a test fails.

Declare a project: lakou.gad

<lakou "Kont GAD"
    id="ht.granlaku.kont"
    vèsyon="1.0.0"
    otè="GETHO GUERRIER"
    konpayi="GRAN LAKU COMPANY"
    lisans="Lisans GAD"
    natif="bilten.gad">
  • With lakou.gad in the folder, gad kouri, gad bati and gad tcheke need no file name.
  • natif is the file that starts the application.

Start a GAD target from the Run panel

The Run panel lists the GAD targets of the project
The Run panel lists the GAD targets of the project
  1. Click Run in the left bar.
  2. Choose a target: the native application, the server, the web page, the Windows application or the tests.
  3. Click the start button at the top of the panel.
  • WASDEV finds the targets by reading the GAD files of the project.
  • The mobile target and the firmware target are listed but not available: they are not in the GAD compiler yet.

Packages

CommandWhat it does
gad pake nouvoCreate pake.toml for this project
gad pake ajoute name sourceAdd a dependency and install it
gad pake enstaleInstall every dependency in the folder pake
gad pake retire nameRemove a dependency
gad pake lisList the dependencies
  • A source is a folder, a git repository or a zip archive on the internet.
  • In your code, use a package with its path: sèvi ak "pake/koule/koule.gad".