Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tests: add tests for SHA256 #1604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
raklaptudirm merged 1 commit into TheAlgorithms:master from vil02:add_tests_for_sha256
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Hashes/tests/SHA256.test.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { describe, test } from 'vitest'
import { SHA256 } from '../SHA256'

describe('Testing SHA256 function', () => {
it.each([
['', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'],
[
'The quick brown fox jumps over the lazy dog',
'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592'
],
[
'The quick brown fox jumps over the lazy cog',
'e4c4d8f3bf76b692de791a173e05321150f7a345b46484fe427f6acc7ecc81be'
],
[
'This was added by vil02 on 01.02.2024. Have a nice day!',
'476025d91db754ab6ac0c124367afd7c108d041b2f497006a214d5035769ed5d'
],
[
'012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789',
'14582b3f153941891dca966b036a5b1de65fa3b7a2540095a31614da1de0feaf'
],
['a', 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb']
])('check with %j', (input, expected) => {
expect(SHA256(input)).toBe(expected)
})
})

AltStyle によって変換されたページ (->オリジナル) /