File: checkoids.t

package info (click to toggle)
libgssapi-perl 0.28-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: perl: 758; makefile: 6
file content (53 lines) | stat: -rwxr-xr-x 1,558 bytes parent folder | download | duplicates (6)
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
47
48
49
50
51
52
53
#! /usr/bin/perl -w

use strict;

use ExtUtils::testlib;

use GSSAPI qw(:all);
use Test::More tests => 1 + 3 * 11;


my $oidset = GSSAPI::OID::Set->new();
ok(ref $oidset eq 'GSSAPI::OID::Set', 'OID set created');

my %tobetested
    = (
       'gss_nt_user_name'         => gss_nt_user_name,
       'gss_nt_hostbased_service' => GSSAPI::OID::gss_nt_hostbased_service,
       'gss_mech_krb5_old'        => gss_mech_krb5_old,
       'gss_mech_krb5'            => gss_mech_krb5,
       'gss_mech_spnego'          => gss_mech_spnego,
       'gss_nt_exported_name'     => gss_nt_exported_name,
       'gss_nt_krb5_name'         => gss_nt_krb5_name,
       'gss_nt_krb5_principal'    => gss_nt_krb5_principal,
       'gss_mech_krb5_v2'         => gss_mech_krb5_v2,
       'gss_nt_machine_uid_name'  => gss_nt_machine_uid_name,
       'gss_nt_string_uid_name'   => gss_nt_string_uid_name,
      );

while ( my ($key,$value) = each %tobetested ) {
    check_oid( $oidset, $value ,$key);
}

#----------------------------------------------------
sub check_oid {
   my ($oidset, $oid, $text) = @_;
   my $isin = 0;

   my $status;

   # check if set does not contain oid
   $status = $oidset->contains( $oid , $isin );
   ok( ! $isin , "$text is not contained in OIDSET");

   # insert oid
   $status  = $oidset->insert( $oid );
   ok($status, "$text is inserted...  ");

   # check again if set does not contain oid
   $status = $oidset->contains( $oid , $isin );
   ok( $isin , "$text is contained in OIDSET");

}
#----------------------------------------------------