mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 05:02:23 +01:00
doh
This commit is contained in:
32
tests/components/sha256/common.yaml
Normal file
32
tests/components/sha256/common.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
esphome:
|
||||
on_boot:
|
||||
- lambda: |-
|
||||
// Test SHA256 functionality
|
||||
#ifdef USE_SHA256
|
||||
using esphome::sha256::SHA256;
|
||||
SHA256 hasher;
|
||||
hasher.init();
|
||||
|
||||
// Test with "Hello World" - known SHA256
|
||||
const char* test_string = "Hello World";
|
||||
hasher.add(test_string, strlen(test_string));
|
||||
hasher.calculate();
|
||||
|
||||
char hex_output[65];
|
||||
hasher.get_hex(hex_output);
|
||||
hex_output[64] = '\0';
|
||||
|
||||
ESP_LOGD("SHA256", "SHA256('Hello World') = %s", hex_output);
|
||||
|
||||
// Expected: a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e
|
||||
const char* expected = "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e";
|
||||
if (strcmp(hex_output, expected) == 0) {
|
||||
ESP_LOGI("SHA256", "Test PASSED");
|
||||
} else {
|
||||
ESP_LOGE("SHA256", "Test FAILED. Expected %s", expected);
|
||||
}
|
||||
#else
|
||||
ESP_LOGW("SHA256", "SHA256 not available on this platform");
|
||||
#endif
|
||||
|
||||
sha256:
|
6
tests/components/sha256/test.host.yaml
Normal file
6
tests/components/sha256/test.host.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# Host platform doesn't support OTA, so we can't test SHA256 indirectly
|
||||
# The SHA256 component is tested via unit tests instead
|
||||
esphome:
|
||||
on_boot:
|
||||
- lambda: |-
|
||||
ESP_LOGI("SHA256", "SHA256 component available on host for library use");
|
1
tests/components/sha256/test.rp2040-ard.yaml
Normal file
1
tests/components/sha256/test.rp2040-ard.yaml
Normal file
@@ -0,0 +1 @@
|
||||
<<: !include common.yaml
|
@@ -1 +0,0 @@
|
||||
sha256:
|
@@ -1,2 +0,0 @@
|
||||
packages:
|
||||
common: !include common.yaml
|
Reference in New Issue
Block a user