1 /**
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <math.h>
17 #include <stdlib.h>
18 #include "functionalext.h"
19
20 const int TWO = 2;
21 const int THRITYONE = 31;
22
23 /**
24 * @tc.name : lcong48_0100
25 * @tc.desc : Verify lcong48 process success. Set random number seed for 48 bit operation.
26 * @tc.level : Level 0
27 */
lcong48_0100(void)28 void lcong48_0100(void)
29 {
30 unsigned short p[7] = {0x0102, 0x0304, 0x0506, 0x0708, 0x090a, 0x0b0c, 0x0d0e};
31 lcong48(p);
32 long ret = mrand48();
33 EXPECT_TRUE("lcong48_0100", ret < pow(TWO, THRITYONE) && ret > -pow(TWO, THRITYONE));
34 }
35
main(void)36 int main(void)
37 {
38 lcong48_0100();
39 return t_status;
40 }