Skip to content

Commit

Permalink
docs: added how tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuchar committed Feb 1, 2016
1 parent 2e9690d commit ad7f9b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ Example file size is 176 bytes
````
Please note, that `getSize()` returns [Brick](https://github.com/brick/math)\\[BigInteger](http://brick.io/math/class-Brick.Math.BigInteger.html). This is due to fact that PHP's internal integer can be too small.

If you need just approximate value of file size you can convert `BigInteger` into `float`. Please note that by doing this you can *loose precision*.
To get *approximate* value of file size you can convert `BigInteger` into `float`. Please note that by doing this you will *loose precision*.

**Tip:** If you are using DI container you are probably interested into non-static configuration. There is example prepared for this scenario. (see examples directory)

## Will this really work? ##

To test things out this project uses Travis to evaluate UNIX systems and Appveyor to check compatibility with Windows. Every driver in this project is tested to return exact values for files over 2^32 in size. More about testing in [tests directory](tests).


**Tip:** If you are using DI container you are probably interested into non-static configuration. There is example prepared for this scenario.

## Under the hood ##

Expand Down
19 changes: 18 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

To run tests follow receipt stored in root of this repository. For Linux in `.travis.yml` or `.gitlab-ci.yml` and for Windows in `appveyor.yml`.

This project uses Nette\Tester. Please follow how to run tests from there.

Tests requires to have fixture files. Create them by calling `setup.sh` or `setup.cmd`.

## Requirements ##

These tests requires approximately 6GB for free space on volume. If you are running tests in VM using dynamic allocated disk you do not need to worry about space. Tests preallocates files - this means that there will be reserved space on disk for these files, however there will be physically nothing written to disk (except file system headers).
These tests requires approximately 6GB for free space on volume. If you are running tests in VM using dynamic allocated disk you do not need to worry about space. Tests preallocates files - this means that there will be reserved space on disk for these files, however there will be physically nothing written to disk (except file system headers).

## Drivers testing methodic ##

There are two boundaries that causes problems - 2^31 bytes size and 2^32 bytes in size.

This means to cover all cases we need three files:
- size < 2^31
- 2^31 < size < 2^32
- size > 2^32

For more information please refer to:
- [setup.sh](setup.sh) and [setup.cmd](setup.cmd) - creating testing fixtures (three big files)
- [BaseDriverTest](BigFileTools/Driver/BaseDriverTest.php) - for test asserts

0 comments on commit ad7f9b2

Please sign in to comment.