~ubuntu-branches/debian/sid/libsereal-encoder-perl/sid

« back to all changes in this revision

Viewing changes to t/702_roundtrip_v2.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-06-06 13:17:09 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20140606131709-ek9vy22c4sh5jgjx
Tags: upstream-3.001
ImportĀ upstreamĀ versionĀ 3.001

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
use strict;
 
3
use warnings;
 
4
use Sereal::Encoder;
 
5
use Data::Dumper;
 
6
use File::Spec;
 
7
 
 
8
# These tests use an installed Decoder (or respectively Encoder) to do
 
9
# round-trip testing. There are two strategies, both with drawbacks:
 
10
# - Test::More's is_deeply is waaaay too lenient to catch all the
 
11
#   subtleties that Sereal is supposed to encode.
 
12
# - Serialize - Deserialize - Serialize, then do a string compare.
 
13
#   This won't catch if the first serialization has bogus output
 
14
#   but the subsequent de- & serialization work for the already
 
15
#   bogus output.
 
16
# These tests can't replace carefully crafted manual tests, I fear.
 
17
 
 
18
use lib File::Spec->catdir(qw(t lib));
 
19
BEGIN {
 
20
  lib->import('lib')
 
21
    if !-d 't';
 
22
}
 
23
 
 
24
use Sereal::TestSet qw(:all);
 
25
use Test::More;
 
26
 
 
27
my $ok = have_encoder_and_decoder();
 
28
if (not $ok) {
 
29
  plan skip_all => 'Did not find right version of decoder';
 
30
}
 
31
else {
 
32
  run_roundtrip_tests(2); # 2 is "run for proto-version 2 only"
 
33
}
 
34
 
 
35
 
 
36
pass();
 
37
done_testing();
 
38