-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmod-sodium.inc
More file actions
41 lines (36 loc) · 1.08 KB
/
mod-sodium.inc
File metadata and controls
41 lines (36 loc) · 1.08 KB
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
<?php
/**
* module sodium test functions
* Php 7.2+
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
function test_41_01_sodium_string_num_int()
{
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
if (!function_exists('sodium_increment')) {
return $emptyResult;
}
$count = $testsLoopLimits['41_01_sodium_string_num_int'];
$time_start = get_microtime();
$num=''.time();
for ($i = 0; $i < $count; $i++) {
sodium_increment($num);
}
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}
function test_41_02_sodium_string_num_float()
{
global $stringTest, $emptyResult, $testsLoopLimits, $totalOps;
if (!function_exists('sodium_increment')) {
return $emptyResult;
}
$count = $testsLoopLimits['41_02_sodium_string_num_float'];
$time_start = get_microtime();
$num=''.microtime(true);
for ($i = 0; $i < $count; $i++) {
sodium_increment($num);
}
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}