summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8df6afe)
When save/restore generate different values, write out the two
versions to one.json and two.json for easy comparison.
Signed-off-by: Keith Packard <keithp@keithp.com>
computed.finish_update();
}
computed.finish_update();
}
measured = new AltosIValue();
computed = new AltosIValue();
}
measured = new AltosIValue();
computed = new AltosIValue();
}
AltosState s = new AltosState();
s.copy(this);
AltosState s = new AltosState();
s.copy(this);
+ /* Code to test state save/restore. Enable only for that purpose
+ */
- AltosJson json = json();
+ AltosJson json = new AltosJson(this);
String onetrip = json.toPrettyString();
AltosJson back = AltosJson.fromString(onetrip);
String onetrip = json.toPrettyString();
AltosJson back = AltosJson.fromString(onetrip);
- AltosState tripstate = AltosState.fromJson(back);
- AltosJson tripjson = tripstate.json();
+ AltosState tripstate = (AltosState) back.make(this.getClass());
+ AltosJson tripjson = new AltosJson(tripstate);
String twotrip = tripjson.toPrettyString();
if (!onetrip.equals(twotrip)) {
String twotrip = tripjson.toPrettyString();
if (!onetrip.equals(twotrip)) {
- System.out.printf("one:\n%s\ntwo:\n%s\n", onetrip, twotrip);
+ try {
+ FileWriter one_file = new FileWriter("one.json", true);
+ one_file.write(onetrip);
+ one_file.flush();
+ FileWriter two_file = new FileWriter("two.json", true);
+ two_file.write(twotrip);
+ two_file.flush();
+ } catch (Exception e) {
+ }
+ System.out.printf("json error\n");