xref: /openbsd-src/gnu/usr.bin/perl/cpan/Win32/t/GetOSName.t (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1use strict;
2use Test;
3use Win32;
4
5my @tests = (
6    #              $id, $major, $minor, $pt, $build, $tag
7    [ "WinWin32s",   0                                  ],
8    [ "Win95",       1, 4,  0                           ],
9    [ "Win95",       1, 4,  0,  0, 67109814, "(a)"      ],
10    [ "Win95",       1, 4,  0,  0, 67306684, "(b1)"     ],
11    [ "Win95",       1, 4,  0,  0, 67109975, "(b2)"     ],
12    [ "Win98",       1, 4, 10                           ],
13    [ "Win98",       1, 4, 10,  0, 67766446, "(2nd ed)" ],
14    [ "WinMe",       1, 4, 90                           ],
15    [ "WinNT3.51",   2, 3, 51                           ],
16    [ "WinNT4",      2, 4,  0                           ],
17    [ "Win2000",     2, 5,  0                           ],
18    [ "WinXP/.Net",  2, 5,  1                           ],
19    [ "Win2003",     2, 5,  2                           ],
20    [ "WinVista",    2, 6,  0,  1                       ],
21    [ "Win2008",     2, 6,  0,  2                       ],
22    [ "Win7",        2, 6,  1                           ],
23);
24
25plan tests => 2*scalar(@tests) + 1;
26
27# Test internal implementation function
28for my $test (@tests) {
29    my($expect, $id, $major, $minor, $pt, $build, $tag) = @$test;
30    my($os, $desc) = Win32::_GetOSName("", $major, $minor, $build||0, $id, $pt);
31    ok($os, $expect);
32    ok($desc, $tag||"");
33}
34
35# Does Win32::GetOSName() return the correct value for the current OS?
36my(undef, $major, $minor, $build, $id, undef, undef, undef, $pt)
37    = Win32::GetOSVersion();
38my($os, $desc) = Win32::_GetOSName("", $major, $minor, $build, $id, $pt);
39ok(scalar Win32::GetOSName(), $os);
40