mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 1df23554b2e3d5f1efc6fbc76ee61d3f7f186c6d
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { hash, StringSHA1 } from 'vs/base/common/hash';
|
||||
|
||||
suite('Hash', () => {
|
||||
test('string', () => {
|
||||
@@ -53,4 +53,28 @@ suite('Hash', () => {
|
||||
assert.notEqual(a, b);
|
||||
});
|
||||
|
||||
function checkSHA1(strings: string[], expected: string) {
|
||||
const hash = new StringSHA1();
|
||||
for (const str of strings) {
|
||||
hash.update(str);
|
||||
}
|
||||
const actual = hash.digest();
|
||||
assert.equal(actual, expected);
|
||||
}
|
||||
|
||||
test('sha1-1', () => {
|
||||
checkSHA1(['\udd56'], '9bdb77276c1852e1fb067820472812fcf6084024');
|
||||
});
|
||||
|
||||
test('sha1-2', () => {
|
||||
checkSHA1(['\udb52'], '9bdb77276c1852e1fb067820472812fcf6084024');
|
||||
});
|
||||
|
||||
test('sha1-3', () => {
|
||||
checkSHA1(['\uda02ꑍ'], '9b483a471f22fe7e09d83f221871a987244bbd3f');
|
||||
});
|
||||
|
||||
test('sha1-4', () => {
|
||||
checkSHA1(['hello'], 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user