Commit graph

120 commits

Author SHA1 Message Date
Dirk Hohndel
41e704bce2 Add the same test dive in a number of different formats
Suuntu DM3
DiveLog 5.08 XML
DiveLog 5.08 UDDF
DiveLog 5.08 UDCF
DiveLog 5.08 compressed zip (we don't support that)
JDiveLig 10.2 from Mac (fails because of ecoding)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-25 20:28:58 -08:00
Linus Torvalds
b62e63650a Fix SAC calculations for dives without any samples
We computed a made-up average depth based on the maximum depth, and used
that.  That's questionable even if we didn't have any explicit average
depth to begin with, but it's particularly wrong if we did have an
explicit average depth to use.

Now, admittedly we have no way to actually create fake dives like this
with a particular average depth, so this really doesn't make any
difference in real life.  But we should do this right.

Also, make the XML be in the format that subsurface actually saves
things in (mainly things like cylinder sizes having an extra decimal
place, but also ordering of XML elements).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-24 11:25:44 -08:00
Linus Torvalds
6d548d2028 Correctly calculate SAC rate in the presense of surface events
This assumes that you are not breathing your cylinders while at the
surface, which may or may not be correct, but is usually the right
thing.  Regardless, we're better off giving a conservative (higher) SAC
rate estimate for a diver that breathes his cylinder at the surface too
than giving an artificially low one because the diver ended up using his
snorkel and we didn't take that into account.

NOTE! This basically calculates a better duration and average depth than
the ones we end up showing in the dive list.  Maybe we should actually
show this "no-surface-time" duration and average depth instead of the
ones we do show?

That's a separate question, though.

Added a test-case for the surface case to the sac-test.xml dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-24 11:09:52 -08:00
Linus Torvalds
f4bf16d5db Fix up SAC calculations for ATM/bar confusion
We even documented that we did SAC in bar*l/min, but the "S" in SAC
stands for "Surface".  So we should normalize SAC rate to surface
pressure, not one bar.

It's a tiny 1% difference, and doesn't actually matter in practice, but
it's noticeable when you want to explicitly test for SAC-rate by
creating a test-dive that averages exactly 10m.  Suddenly you don't get
the round numbers you expect.

[ Side note: 10m is not _exactly_ one extra atmosphere according to our
  calculations, but it's darn close in sea water: the standard salinity
  of 1.03 kg/l together with the standard acceleration of 9.81m/s^2
  gives an additional pressure of 1.01 bar, which is within a fraction
  of a percent of one ATM.

  Of course, divers have likely chosen that value exactly for the math
  to come out that way, since the true average salinity of seawater is
  actually slightly lower ]

So here's a few test-dives, along with the SAC rate fixup to make them
look right.

(There's also a one-liner to dive.c that makes the duration come out
right if the last sample has a non-zero depth, and the previous sample
did not: one of my original test-dives did the "average 10m depth" by
starting at 0 and ending at 20m, and dive.c got a tiny bit confused
about that ;)

[ The rationale for me testing our SAC rate calculations in the first
  place was that on snorkkeli.net user "Poltsi" reported that our SAC rate
  calculations differ from the ones that Suunto DM4 reports. So I wanted
  to verify that we did things right.

  Note that Poltsi reported differences larger than the difference of
  BAR/ATM, so this is not the cause. I'll continue to look at this. ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-24 10:49:26 -08:00
Dirk Hohndel
1bcc8dd991 Add test dive for constant temperature
Making sure that this doesn't cause divisions by zero and that the scaling
and positioning doesn't get messed up by it (right now it doesn't look
great).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24 13:19:16 -08:00
Henrik Brautaset Aronsen
693ee686df Add GPS locations to some of the test dives
With Pierre-Yves' commit with a map widget, here are a couple of example
GPS locations from my own dives.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13 10:23:38 -08:00
Dirk Hohndel
c796c16115 Add two test dives that triggered the bug fixed in the previous commit
Loading these two XML files created a divelist with two trips that each
started at the same time but that were NOT linked together (because the
code in insert_trip detected that they started at the same time). Since
the trips were not linked together, trying to then merge those two trips
from the UI got us into an infinite loop, trying to move a dive from one
trip into the same trip (as the code couldn't find the trip that wasn't
linked into the dive_trip_list).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-06 13:06:16 -08:00
Dirk Hohndel
421366d0fb Correctly deal with empty XML files
Previously we could end up with a bogus dive with all zero data in it.

Adding dives/test24.xml to be able to test that we handle this case
correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-17 21:03:30 -04:00
Dirk Hohndel
2a1d7a510c Correct the trip related test dives
They still had the old "date only" format, but the code now relies on date
and time being both set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-03 10:31:25 -07:00
Dirk Hohndel
6500e943c1 Some simple test dives for the trips code
Playing with these shows that there are still some issues with handling
multiple files correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-27 14:34:21 -07:00
Dirk Hohndel
d7482356fd Add three more trimix test dives
This allows us to check what we display in the dive list and how we sort
it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-12 10:12:29 -08:00
Dirk Hohndel
1802487e4f Make test dive 15 a bit more useful
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-12 10:11:53 -08:00
Dirk Hohndel
989a70727d Two test dives I added a couple of months ago
...and never commited

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-12 09:24:54 -08:00
Dirk Hohndel
bb09b67182 Add trimix test dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-11 16:00:47 -08:00
Dirk Hohndel
e38eb77e30 Correctly plot dives ending below the surface
I thought we had fixed this before - but I guess it got broken again
somewhere. We now make sure that the plot_info ends on an entry with
depth 0.

Added test14 to verify the fix.

Also fixed cut'n'paste errors in a few test dive files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-09 07:53:10 -08:00
Dirk Hohndel
4b735521e2 Fix missing pressure plot at start of the dive in some situations
In some situations we could end up with no sample pressure and no
interpolated pressure at time = 0. This is now fixed.

Fix notes in test dive the exposed the issue.

Also change the code in create_plot_info to keep the number of samples and
the number of corresponding pi entries in separate variables. This avoids
future changes from breaking if they assume they can access
dive->sample[nr_samples - 1] (which is a reasonable assumption to make).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 15:38:46 -07:00
Dirk Hohndel
68bd80dff4 Update test dives
The notes now reflect things that were fixed in the last commits.
Also added more test dives to test other boundary cases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 14:54:22 -07:00
Dirk Hohndel
ef7771ebf2 Replace Linus' dives with useful test dives that help test the app
As much as Linus' dives may be fun to look at, they don't help us test the
app. Writing these test dives I already found a couple of bugs - and I'm
just getting started.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04 10:47:38 -07:00
Linus Torvalds
fb214b2b39 Make the multi-dive files valid XML
They had multiple "root" entries (all called 'dive'), which makes baby
Jesus cry.

So just enclose them all in one root entry (called 'dives') that
magically turns it all into parseable xml.

Yeah, that really helps make the world a better place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-28 17:24:53 -07:00
Linus Torvalds
857e153070 Start archiving the stupid XML files
(and add a reminder of how they came to be)

Gaah.  XML is *stupid*.  It's not easy to parse for humans or for
computers, and some of these XML files are just disgusting.  But maybe
they can be turned into something usable with libxml.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-28 16:18:53 -07:00