Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LargeFileHelperTest.php « lib « tests - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3cc9d13d74ce000af07e802503680aaaa330a308 (plain)
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
<?php
/**
 * Copyright (c) 2014 Andreas Fischer <bantu@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace Test;

class LargeFileHelperTest extends TestCase {
	protected $helper;

	protected function setUp(): void {
		parent::setUp();
		$this->helper = new \OC\LargeFileHelper;
	}

	public function testFormatUnsignedIntegerFloat() {
		$this->assertSame(
			'9007199254740992',
			$this->helper->formatUnsignedInteger((float) 9007199254740992)
		);
	}

	public function testFormatUnsignedIntegerInt() {
		$this->assertSame(
			PHP_INT_SIZE === 4 ? '4294967295' : '18446744073709551615',
			$this->helper->formatUnsignedInteger(-1)
		);
	}

	public function testFormatUnsignedIntegerString() {
		$this->assertSame(
			'9007199254740993',
			$this->helper->formatUnsignedInteger('9007199254740993')
		);
	}

	
	public function testFormatUnsignedIntegerStringException() {
		$this->expectException(\UnexpectedValueException::class);

		$this->helper->formatUnsignedInteger('900ABCD254740993');
	}
}