void Reading::ValidateJson(string input) { _validReading = false; _errorMessage = ""; TestString("#A-C=",input); _accelerationXAxis = GetNextDouble(input); TestString(",",input); _accelerationYAxis = GetNextDouble(input); TestString(",",input); _accelerationZAxis = GetNextDouble(input); _validReading = _errorMessage == ""; }
/** Starts the search with the set modules and the set search text. */ void CSearchDialog::startSearch() { QString originalSearchText(m_searchOptionsArea->searchText()); QString searchText(""); // first check the search string for errors { QString TestString(originalSearchText); QRegExp ReservedWords("heading:|footnote:|morph:|strong:"); if (TestString.replace(ReservedWords, "").simplified().isEmpty()) { return; } } searchText = prepareSearchText(originalSearchText); // Insert search text into history list of combobox m_searchOptionsArea->addToHistory(originalSearchText); // check that we have the indices we need for searching if (!m_searcher.modulesHaveIndices( modules() ) ) { int result = util::showQuestion(this, tr("Missing indices"), tr("One or more works need indexing before they can be searched.\n" "This could take a long time. Proceed with indexing?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); // In SuSE 10.0 the result is the logical or of the button type, just like it is // inputed into the QMessageBox. if ( (result == (QMessageBox::Yes | QMessageBox::Default)) || (result == QMessageBox::Yes) || (result == QMessageBox::Default) ) { CModuleIndexDialog* dlg = CModuleIndexDialog::getInstance(); dlg->indexUnindexedModules( modules() ); } else { return; } } if (m_searchOptionsArea->hasSearchScope()) { m_searcher.setSearchScope( m_searchOptionsArea->searchScope() ); } else { m_searcher.resetSearchScope(); } m_searcher.setModules( modules() ); m_searcher.setSearchedText(searchText); //Just to be sure that it can't be clicked again, if the search happens to be a bit slow. m_searchOptionsArea->searchButton()->setEnabled(false); m_searchOptionsArea->m_searchTextCombo->setEnabled(false); m_searcher.startSearch(); m_searchOptionsArea->searchButton()->setEnabled(true); m_searchOptionsArea->m_searchTextCombo->setEnabled(true); m_searchOptionsArea->m_searchTextCombo->setFocus(); }
TEST(TestTinyXML, read_score) { tinyxml2::XMLDocument doc; EXPECT_EQ(doc.LoadFile("..\\autumn leaves.xml"), tinyxml2::XMLError::XML_SUCCESS); const auto root = doc.FirstChildElement("chord-score"); const auto score = root->FirstChildElement("score"); TestString(score->Name(), "score"); }
void main() { TestHeap(); TestSort(); TestList(); TestString(); // printf("End."); char c; scanf_s("%c", &c); }
void Reading::ValidateJson(string input) { _validReading = false; _errorMessage = ""; /* TestString("#YPR=",input); _ya = GetNextDouble(input); TestString(",",input); _pitch = GetNextDouble(input); TestString(",",input); _roll = GetNextDouble(input); */ TestString("#A-C=",input); _accelerationXAxis = GetNextDouble(input); TestString(",",input); _accelerationYAxis = GetNextDouble(input); TestString(",",input); _accelerationZAxis = GetNextDouble(input); TestString("\r\n#G-C=",input); _gyroXAxis = GetNextDouble(input); TestString(",",input); _gyroYAxis = GetNextDouble(input); TestString(",",input); _gyroZAxis = GetNextDouble(input); _validReading = _errorMessage == ""; }
int main() { TestLong(); TestString(); TestWideString(); TestBool(); TestDate(); TestVariant(); TestInterface(); TestSmartPointer(); TestError(); return 0; }
bool C_coretestBase::TestString(int callbackID, const Json::Value& parameters) { Json::Value testString_JSON; FetchObject(parameters, "testString", testString_JSON); std::string testString; FetchString(testString_JSON, testString); TestString(callbackID, testString.c_str()); return true; }
void TestWithContainers( const Allocator& a ) { TestVector( a ); TestDeque( a ); TestList( a ); TestSet( a ); TestMultiset( a ); TestMap( a ); TestMultimap( a ); TestString( a ); TestStack( a ); TestQueue( a ); TestPriorityQueue( a ); }
std::vector<TestString> TestStringVectorSetup(std::string input_string) { std::vector<uint8_t> input_bytes = ByteVectorFromString(input_string, "hex"); std::string xor_output_string; uint8_t xor_character = 0; std::vector<uint8_t> xor_vector; std::vector<uint8_t> xor_output_bytes; std::vector<TestString> output_strings; xor_vector = CreateSingleCharacterXorVector(xor_character, input_bytes.size()); xor_output_bytes = XorByteVectors(input_bytes, xor_vector); xor_output_string = StringFromByteVector(xor_output_bytes, "ASCII"); output_strings.push_back(TestString(input_string, xor_output_string, xor_character)); for (xor_character = 1; xor_character != 0; xor_character++) { //test all potential i's xor_vector = CreateSingleCharacterXorVector(xor_character, input_bytes.size()); xor_output_bytes = XorByteVectors(input_bytes, xor_vector); xor_output_string = StringFromByteVector(xor_output_bytes, "ASCII"); output_strings.push_back(TestString(input_string, xor_output_string, xor_character)); } return output_strings; }
void MultithreadTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) { if (exec) logln("TestSuite MultithreadTest: "); switch (index) { case 0: name = "TestThreads"; if (exec) TestThreads(); break; case 1: name = "TestMutex"; if (exec) TestMutex(); break; case 2: name = "TestThreadedIntl"; #if !UCONFIG_NO_FORMATTING if (exec) { TestThreadedIntl(); } #endif break; case 3: name = "TestCollators"; #if !UCONFIG_NO_COLLATION if (exec) { TestCollators(); } #endif /* #if !UCONFIG_NO_COLLATION */ break; case 4: name = "TestString"; if (exec) { TestString(); } break; default: name = ""; break; //needed to end loop } }
int main(int argc, char* argv[]) { TestDatatypeSizes(); TestMasks(); TestString(); TestStack(); TestQueue(); TestList(); TestDictionary(); return 0; }
INTN EFIAPI ShellAppMain ( IN UINTN Argc, IN CHAR16 **Argv ) { EFI_GUID mStrPackageGuid = { 0xedd31def, 0xf262, 0xc24e, 0xa2, 0xe4, 0xde, 0xf7, 0xde, 0xcd, 0xcd, 0xee }; //首先注册字符串资源文件:将我们的字符串package加入到Hii数据库中 EFI_HANDLE HiiHandle = HiiAddPackages (&mStrPackageGuid , gImageHandle, exampleStrings, NULL); //通过字符串标识符访问字符串。 InitShellLib(); ShellPrintHiiEx(-1,-1,(const CHAR8*)"en-US",STRING_TOKEN (STR_LANGUAGE_SELECT), HiiHandle); TestString(HiiHandle); TestLang(HiiHandle); return 0; }
void TestString( const Allocator& aIn ) { // Strings are made of chars or wide chars typedef typename Allocator::template rebind< char >::other CharAlloc; typedef typename Allocator::template rebind< wchar_t >::other WCharAlloc; typedef std::basic_string< char, std::char_traits< char >, CharAlloc > String; typedef std::basic_string< wchar_t, std::char_traits< wchar_t >, WCharAlloc > WString; // string CharAlloc a( aIn ); String s1( Policy< Allocator >::template GetDefault< String >( a ) ); String s2( Policy< Allocator >::template GetCopied< String >( a ) ); TestString( a, s1 ); TestString( a, s2 ); s1.swap( s2 ); TestString( a, s1 ); TestString( a, s2 ); // wstring WCharAlloc wa( aIn ); WString w1( Policy< Allocator >::template GetDefault< WString >( wa ) ); WString w2( Policy< Allocator >::template GetCopied< WString >( wa ) ); TestString( wa, w1 ); TestString( wa, w2 ); w1.swap( w2 ); TestString( wa, w1 ); TestString( wa, w2 ); }
void Test( void ) { int i; char buf[10]; /* create all the fundamental types */ for( i = DW_FT_MIN; i < DW_FT_MAX; ++i ) { FundamentalTypes[i] = DWFundamental( Client, itoa(i,buf,10), i, 2 ); } /* and let's get some constant versions of them */ for( i = DW_FT_MIN; i < DW_FT_MAX; ++i ) { ConstantFundamentalTypes[i] = DWModifier( Client, FundamentalTypes[i], DW_MOD_CONSTANT ); } ConstCharStar = DWPointer( Client, ConstantFundamentalTypes[DW_FT_SIGNED_CHAR], 0 ); TestMacInfo(); TestTypedef(); TestPointer(); TestString(); TestArray(); TestEnum(); TestStruct1(); TestStruct2(); TestStruct3(); TestSubroutineType(); TestLexicalBlock(); TestCommonBlock(); TestSubroutine(); TestLine(); TestAranges(); TestPubnames(); }
TimeSpec::Unit TimeSpec::StringToUnit(const char *str) { str = SkipWhite(str); if (TestString("nanoseconds", str) || TestString("ns", str)) return Nanosec; if (TestString("microseconds", str) || TestString("us", str)) return Microsec; if (TestString("milliseconds", str) || TestString("ms", str)) return Millisec; if (TestString("seconds", str) || TestString("sec", str) || TestString("s", str)) return Seconds; if (TestString("minutes", str) || TestString("min", str) || TestString("m", str)) return Minutes; return None; }
void MultithreadTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) { if (exec) logln("TestSuite MultithreadTest: "); switch (index) { case 0: name = "TestThreads"; if (exec) TestThreads(); break; case 1: name = "TestMutex"; if (exec) TestMutex(); break; case 2: name = "TestThreadedIntl"; #if !UCONFIG_NO_FORMATTING if (exec) { TestThreadedIntl(); } #endif break; case 3: name = "TestCollators"; #if !UCONFIG_NO_COLLATION if (exec) { TestCollators(); } #endif /* #if !UCONFIG_NO_COLLATION */ break; case 4: name = "TestString"; if (exec) { TestString(); } break; case 5: name = "TestArabicShapingThreads"; if (exec) { TestArabicShapingThreads(); } break; case 6: name = "TestAnyTranslit"; if (exec) { TestAnyTranslit(); } break; case 7: name = "TestConditionVariables"; if (exec) { TestConditionVariables(); } break; case 8: name = "TestUnifiedCache"; if (exec) { TestUnifiedCache(); } break; #if !UCONFIG_NO_TRANSLITERATION case 9: name = "TestBreakTranslit"; if (exec) { TestBreakTranslit(); } break; #endif default: name = ""; break; //needed to end loop } }