File: 12-set-get-binary.t

package info (click to toggle)
libmemcached-libmemcached-perl 1.001801%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 912 kB
  • ctags: 773
  • sloc: perl: 1,674; makefile: 25
file content (46 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

# tests for functions documented in memcached_set.pod

use strict;
use warnings;

use Test::More;

use Memcached::libmemcached
    #   functions explicitly tested by this file
    qw(
        memcached_set
        memcached_get
    ),
    #   other functions used by the tests
    qw(
        memcached_server_add
        memcached_create
        memcached_behavior_set
        memcached_free
        memcached_errstr
    ),
    #   binary protocol constant 
    qw(
        MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
    );

use lib 't/lib';
use libmemcached_test;

my $memc = libmemcached_test_create({ min_version => "1.4.0" });

plan tests => 5;

ok memcached_behavior_set($memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);

my $val = 'this is a test';
ok memcached_set($memc, 'abc', $val);

is memcached_errstr($memc), 'SUCCESS';

my ($flags, $rc);
is memcached_get($memc, 'abc', $flags=0, $rc=0), $val;

ok $rc;