-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
common/src/test/java/cz/crcs/ectester/common/ParamSerializationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cz.crcs.ectester.common; | ||
|
||
import cz.crcs.ectester.common.ec.EC_Category; | ||
import cz.crcs.ectester.common.ec.EC_Data; | ||
import cz.crcs.ectester.common.ec.EC_Params; | ||
import cz.crcs.ectester.data.EC_Store; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ParamSerializationTests { | ||
|
||
@Test | ||
public void test() { | ||
EC_Store store = EC_Store.getInstance(); | ||
Map<String, EC_Category> categories = store.getCategories(); | ||
|
||
for (EC_Category category : categories.values()) { | ||
Map<String, EC_Data> objects = category.getObjects(); | ||
for (EC_Data object : objects.values()) { | ||
if (object instanceof EC_Params) { | ||
EC_Params params = (EC_Params) object; | ||
byte[] serialized = params.flatten(); | ||
EC_Params deserialized = new EC_Params(params.getId(), params.getParams()); | ||
deserialized.inflate(serialized); | ||
assertEquals(params, deserialized, "Category: " + category.getName() + ", Params: " + params.getId()); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters