Преглед изворни кода

Added support with empty database and some basic test scripts

Fixing-travis-yml
BinHong Lee пре 7 година
родитељ
комит
4c88b528f8
9 измењених фајлова са 65 додато и 18 уклоњено
  1. +3
    -0
      .gitignore
  2. +3
    -0
      .travis.yml
  3. +3
    -2
      README.md
  4. +4
    -3
      build.xml
  5. +6
    -0
      circle.yml
  6. +4
    -4
      database.txt
  7. +4
    -0
      install.sh
  8. +37
    -9
      src/main.cpp
  9. +1
    -0
      vehiclesData.json

+ 3
- 0
.gitignore Прегледај датотеку

@@ -1,6 +1,9 @@
bin
obj
database.txt
vehiclesData.json
# Compiled Object files
*.slo
*.lo


+ 3
- 0
.travis.yml Прегледај датотеку

@@ -0,0 +1,3 @@
language: cpp
install: ./install.sh
script: ant test

+ 3
- 2
README.md Прегледај датотеку

@@ -7,12 +7,13 @@ For detailed code documentations, please visit [https://binhonglee.github.io/Tic

##### Disclaimer:

This program is still in progress and is currently in a **NOT WORKING** condition. This is due to the fact that ant does not support taking in inputs in command line thus a GUI implementation is needed for this program to function as intended.
This program is still in progress and is currently in a **NOT WORKING** condition.

## Setting up and running it

```sh
$ git clone https://github.com/binhonglee/TicketingSystem.git
$ cd TicketingSystem
$ ant execute
$ ant build
$ ./bin/main
```

+ 4
- 3
build.xml Прегледај датотеку

@@ -21,7 +21,7 @@
</path>

<target name="targets">
<echo message="Targets are clean, build, execute, targets"/>
<echo message="Targets are clean, build, targets, test"/>
</target>

<target name="build">
@@ -88,10 +88,11 @@
<libset dir="${client.lib.path}" libs="${client.lib.list}"/>
<fileset dir="${src}" includes="Person.cpp,LogInSystem.cpp,Vehicle.cpp,VehicleManager.cpp,main.cpp"/>
</cc>

<echo message="To run the program, input './bin/main' into the command line."/>
</target>

<target name="execute" depends="build">
<exec executable="./bin/main"/>
<target name="test" depends="build, clean">
</target>

<target name="clean">


+ 6
- 0
circle.yml Прегледај датотеку

@@ -0,0 +1,6 @@
dependencies:
pre:
- ./install.sh
test:
override:
- ant test

+ 4
- 4
database.txt Прегледај датотеку

@@ -1,4 +1,4 @@
binhonglee bhlee03655 binhonglee@hotmail.com +13479618886 1
binhong binhong binhong@binhong.me +14802527013 2
who whut wtf_is_happening@binhong.me +999999999 3
testing password testing@binhong.me +601111111111 4
binhonglee bhlee03655 binhonglee@hotmail.com +13479618886 1
binhong binhong binhong@binhong.me +14802527013 2
who whut wtf_is_happening@binhong.me +999999999 3
testing password testing@binhong.me +601111111111 4

+ 4
- 0
install.sh Прегледај датотеку

@@ -0,0 +1,4 @@
cp lib/anttasks.jar ~
pushd ~
jar xf anttasks.jar
pushd -0

+ 37
- 9
src/main.cpp Прегледај датотеку

@@ -1,15 +1,41 @@
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <json/json.h>
#include <exception>
#include "VehicleManager.hpp"
#include "LogInSystem.hpp"
using namespace std;
int main()
{
LogInSystem users("database.txt");
VehicleManager vehicles("vehiclesData.json");
string userFile = "database.txt";
string vehicleFile = "vehiclesData.json";
LogInSystem users;
VehicleManager vehicles;
ifstream userfile(userFile);
if (userfile)
{
users = LogInSystem(userFile);
}
else
{
users = LogInSystem();
}
ifstream vehiclefile(vehicleFile);
if (vehiclefile)
{
vehicles = VehicleManager(vehicleFile);
}
else
{
vehicles = VehicleManager();
}
int currentUser = -1;
@@ -27,9 +53,14 @@ int main()
switch (userOption)
{
case 1:
while (users.getWrongPass() < 3 && currentUser != -1)
if (users.getWrongPass() < 3)
{
currentUser = users.login();
if (currentUser != -1)
{
users.loggedIn(users.getUser(currentUser));
}
}
break;
case 2: users.loggedIn(users.registration()); break;
@@ -39,11 +70,8 @@ int main()
}
}
Vehicle test = Vehicle(10, 5, 0);
users.toTxtFile(userFile);
vehicles.toJson(vehicleFile);
if (test.bookSeat(3, 4, 10))
{
cout << "Booking success" << endl;
}
test.printMap(10);
return 0;
}

+ 1
- 0
vehiclesData.json Прегледај датотеку

@@ -0,0 +1 @@
null

Loading…
Откажи
Сачувај