Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewjaykeller/d2221e80477552594ec42ae15515b8f4 to your computer and use it in GitHub Desktop.
Save andrewjaykeller/d2221e80477552594ec42ae15515b8f4 to your computer and use it in GitHub Desktop.
A snippet of test code from OpenBCI_Wifi test code
void testGetStringLLNumber() {
test.describe("getStringLLNumber");
unsigned long long temp_ull = 8388607000000000;
String actualString = wifi.getStringLLNumber(temp_ull);
test.assertEqual(actualString, "8388607000000000", "should be able to convert unsigned long long", __LINE__);
double temp_d = 8388607000000000.5;
actualString = wifi.getStringLLNumber((unsigned long long)temp_d);
test.assertEqual(actualString, "8388607000000000", "should be able to convert a positive double", __LINE__);
temp_d = -8388606000000000.122;
actualString = wifi.getStringLLNumber((long long)temp_d);
test.assertEqual(actualString, "-8388606000000000", "should be able to convert a negative double", __LINE__);
temp_d = ADC_24BIT_MAX_VAL_NANO_VOLT;
actualString = wifi.getStringLLNumber((unsigned long long)temp_d);
test.assertEqual(actualString, "8388607000000000", "should be able to convert a positive double again", __LINE__);
temp_d = -1* ADC_24BIT_MAX_VAL_NANO_VOLT;
actualString = wifi.getStringLLNumber((long long)temp_d);
test.assertEqual(actualString, "-8388607000000000", "should be able to convert a negative double again", __LINE__);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment