Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * tests.phps, Version 1.0; Based on version 1.11 of oid.c |
||
5 | * Copyright 2014-2015 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | |||
21 | // TODO: more testcases |
||
22 | |||
23 | error_reporting(E_ALL | E_NOTICE | E_DEPRECATED | E_STRICT); |
||
24 | |||
25 | require_once __DIR__ . '/OidDerConverter.class.phps'; |
||
26 | |||
27 | assert(OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER('.2.999')) == '06 02 88 37'); |
||
28 | assert(OidDerConverter::derToOID(array(0x06, 0x02, 0x88, 0x37)) == '.2.999'); |
||
29 | |||
30 | assert(OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER('2.999', true)) == '0D 03 02 87 67'); |
||
31 | assert(OidDerConverter::derToOID(array(0x0D, 0x03, 0x02, 0x87, 0x67)) == '2.999'); |
||
32 | |||
33 | assert(OidDerConverter::derToOID(OidDerConverter::hexstrToArray('0D 03 02 87 67')) == '2.999'); |
||
34 | assert(OidDerConverter::derToOID(OidDerConverter::hexstrToArray('\x0D\x03\x02\x87\x67')) == '2.999'); |