Skip to content

Commit

Permalink
Improve Readme commands, document tests as round-trip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Nov 15, 2018
1 parent eb56802 commit 1542f1a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ You will be asked whether to grant your application access to the spreadsheets.

## Building

The application uses Gradle to build. You can build a complete jar file using `gradlew fatJar`. The jar file can be found as `build/libs/DDSaveEditor.jar`.
The application uses Gradle to build. You can build a complete jar file using `./gradlew fatJar`. The jar file can be found as `build/libs/DDSaveEditor.jar`.

If you are using the spreadsheets service, you can add the `client_secret.json` to `src/main/resources` and build with `gradlew fatJar -PincludeSecret`. This will include the id and secret in the jar file so you don't need to add a separate `client_secret.json` to the file system, just make sure you don't accidentally give this jar to anyone else as this would incur the risk of API Key abuse.
If you are using the spreadsheets service, you can add the `client_secret.json` to `src/main/resources` and build with `./gradlew fatJar -PincludeSecret`. This will include the id and secret in the jar file so you don't need to add a separate `client_secret.json` to the file system, just make sure you don't accidentally give this jar to anyone else as this would incur the risk of API Key abuse.

### Tests

In `src/tests`, there are a number of save files, some are mine, some are picked from other places on the internet. By running `gradlew test`, the tests check if all of them can be loaded, and produce somewhat correct save files again.
In `src/tests`, there are a number of save files, some are mine, some are picked from other places on the internet. By running `./gradlew test`, a round trip-test is performed: the tests check if all of them can be loaded, and produce somewhat correct save files again.
If the game updates, we'll probably need to update those save files too (I don't expect major changes to the format, but there might be the occasional new field that needs to be identified).

## Contributing

Contributions via Pull Requests or Issue reports welcome! For Pull Requests, please make sure that the unit tests pass and include your own save files as tests.
Contributions via Pull Requests or Issue reports welcome! For Pull Requests, please make sure that the round-trip tests pass and include your own save files as tests.

## Plans

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@

import de.robojumper.ddsavereader.file.DsonFile.UnhashBehavior;

/**
* Class that performs round-trip tests on provided save files. Decodes,
* encodes, decodes again. A file must encode to the same size that it decoded
* from (save for `persist.progression.json`, which has a duplicate key), and
* that file must decode to the exact same text that the original file decoded
* to. We can't check for binary equality for encoded files, as the game has a
* tendency to write garbage bits / bits I don't know the purpose for to the
* save file.
*/
public class ConverterTests {

@BeforeClass
Expand Down Expand Up @@ -93,7 +102,7 @@ public void testSwitchProfile() throws ParseException, IOException {
public void testRedditProfile() throws ParseException, IOException {
testCorrectConversion("profileReddit");
}

@Test
public void testOtherFiles() throws ParseException, IOException {
testCorrectConversion("otherFiles");
Expand Down

0 comments on commit 1542f1a

Please sign in to comment.