The goals of these exercises and homework are:
- to write simple programs in Swift;
- to write simple tests over the programs;
- to use continuous integration and GitHub.
A Pokemon is a creature that has a species, an optional nickname (most do not), at most four moves, a level, experience, stats and other information.
Its species defines the Pokemon type(s), the available moves, Each move has exactly one type(s).
The source code in Sources/swift_exercises.swift
already contains type definitions for all these notions (and more).
You have to implement the TODO
s.
In order to do this homework, follow these steps:
- Fork the subject repository. It will create a copy in your own account, where you can work.
- Invite your teachers to your repository. It will give them write access, that will only be used to add your grade.
- Create a pull request from your repository to the reference one. This is only possible if you have made some changes to the code. The pull request will follow your work: you do not need to create a new one if you update your work.
If you have questions on the subject, please fill an issue in the subject repository. If your question is about your implementation, please fill an issue in your repository.
All exercises are incremental: their code is built upon the previous ones. You must write tests for your code. It is for instance a good idea to implement the examples given in bulbapedia.
Tests are put in functions located in the Tests/swift-exercisesTests.swift
file.
Do not forget to list them also explicitly in the allTests
array.
For testing, we use wercker continuous integration. It has a command-line interface that you must install. To run the tests, type the following command in the terminal:
$ wercker build
Tests will be automatically run in your pull request. GitHub shows the result (pass or fail) in its interface.