Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deepenpatel19/golang-test


https://github.com/deepenpatel19/golang-test

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

Golang Test - Find 2D Rectangel Intersection

Example (in terminal):
1) When Intersection possible.
```
./golang_test test.json
```
Output:
```
Input:
1: Rectangle at (100,100), w=250, h=80.
2: Rectangle at (120,200), w=250, h=150.
3: Rectangle at (140,160), w=250, h=100.
4: Rectangle at (160,140), w=350, h=190.
Intersections:
1 Between rectangle 1 and 3, at (140, 160), w=210, h=20.
2 Between rectangle 1 and 4, at (160, 140), w=190, h=40.
3 Between rectangle 2 and 3, at (140, 200), w=230, h=60.
4 Between rectangle 2 and 4, at (160, 200), w=210, h=130.
5 Between rectangle 3 and 4, at (160, 160), w=230, h=100.
6 Between rectangle 1, 3 and 4, at (160, 160), w=190, h=20.
7 Between rectangle 2, 3 and 4, at (160, 200), w=210, h=60.
```

2) When file not found in command line argument
```
./golang_test
```
Output:
```
File name not found in arguments.
```

3) When wrond formatted JSON file.
```
./golang_test error_file.json
```

Output:
```
JSON file not in proper format.
```