void ComponentsUnitTests::testLcidFilters() { Components components; ComponentPtr component_currentlcid(new MsiComponent()); component_currentlcid->os_filter_lcid = L"1040"; ComponentPtr component_anotherlcid(new MsiComponent()); component_anotherlcid->os_filter_lcid = L"!1040"; components.add(component_currentlcid); components.add(component_anotherlcid); Assert::IsTrue(components.size() == 2); Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 1); }
void ComponentsUnitTests::testPAFilters() { Components components; ComponentPtr component_currentpa(new MsiComponent()); component_currentpa->processor_architecture_filter = L"mips"; ComponentPtr component_anotherpa(new MsiComponent()); component_anotherpa->processor_architecture_filter = L"x86,x64"; components.add(component_currentpa); components.add(component_anotherpa); Assert::IsTrue(components.size() == 2); Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 1); Assert::IsTrue(get(components.GetSupportedComponents(LcidUser, SequenceInstall)[0]) == get(component_anotherpa)); }
void ComponentsUnitTests::testAdd() { Components components; ComponentPtr component1(new CmdComponent()); component1->id = DVLib::GenerateGUIDStringW(); ComponentPtr component2(new CmdComponent()); component2->id = DVLib::GenerateGUIDStringW(); components.add(component1); components.add(component2); Assert::IsTrue(components.size() == 2); Assert::IsTrue(components.contains(component1->id)); Assert::IsTrue(components.contains(component2->id)); Assert::IsTrue(! components.contains(DVLib::GenerateGUIDStringW())); }
TagWriter::TagWriter(const c2lang::SourceManager& SM_, const Components& components) : SM(SM_) , currentFile(0) { for (unsigned c=0; c<components.size(); c++) { const ModuleList& mods = components[c]->getModules(); for (unsigned m=0; m<mods.size(); m++) { const AstList& modFiles = mods[m]->getFiles(); for (unsigned i=0; i<modFiles.size(); i++) { analyse(*modFiles[i]); } } } }
void ComponentsUnitTests::testOsFilters() { Components components; ComponentPtr component1(new MsiComponent()); component1->os_filter = L"!winXP"; ComponentPtr component2(new MsiComponent()); component2->os_filter = L"winXPsp1"; ComponentPtr component3(new MsiComponent()); component3->os_filter = L"winXP"; ComponentPtr component4(new MsiComponent()); components.add(component1); components.add(component2); components.add(component3); components.add(component4); Assert::IsTrue(components.size() == 4); Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 2); }
int InstallerWindow::ExecOnThread() { try { auto_any<htmlayout::dom::element *, html_disabled> btn_install(& button_install); htmlayout::queue::push(new html_set_attribute_task(& button_install, "disabled", L"disabled"), HtmlWindow::s_hwnd); auto_any<htmlayout::dom::element *, html_disabled> btn_skip(& button_skip); htmlayout::queue::push(new html_set_attribute_task(& button_skip, "disabled", L"disabled"), HtmlWindow::s_hwnd); ClearError(); ClearProgress(); InstallConfiguration * p_configuration = reinterpret_cast<InstallConfiguration *>(get(m_configuration)); CHECK_BOOL(p_configuration != NULL, L"Invalid configuration"); if (RestartElevated()) { OnCancel(); return 0; } Components components = p_configuration->GetSupportedComponents( InstallerSession::Instance->lcidtype, InstallerSession::Instance->sequence); SetProgressTotal(components.size() * 2); int rc = components.Exec(this); InstallerUI::AfterInstall(rc); return 0; } catch(std::exception& ex) { LOG(L"*** Failed to install one or more components: " << DVLib::string2wstring(ex.what())); ShowError(DVLib::string2wstring(ex.what())); RecordError(); } catch(...) { LOG(L"*** Failed to install one or more components"); ShowError(TEXT("Failed to install one or more components")); RecordError(); } return 0; }
void ComponentsUnitTests::testOsFiltersGreaterSmaller() { Components components; ComponentPtr component1(new MsiComponent()); component1->os_filter_min = winNone; component1->os_filter_max = winXPMax; ComponentPtr component2(new MsiComponent()); component2->os_filter_min = winXP; component2->os_filter_max = winServer2003Max; ComponentPtr component3(new MsiComponent()); component3->os_filter_min = winXP; component3->os_filter_max = winNone; components.add(component1); components.add(component2); components.add(component3); Assert::IsTrue(components.size() == 3); Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 1); }
auto search(uint32_t limit, const PrimeNumbers &primes) { const size_t iteration_limit = 10000; auto initial = initial_candidate(limit, primes); Components components = {initial, initial}; for(size_t i=0;components.size() && i<iteration_limit;++i,components=next(components,initial,limit,primes)) { auto fraction = quotient(components); if(is_permuted_pair(fraction.p(),fraction.q())) { if(!util::test_mode()) { fmt::print("[{}] {}x{} -> {} ({})\n",i, *components[0], *components[1], fraction, static_cast<double>(fraction)); } return std::make_tuple(true,fraction); }; } return std::make_tuple(false,quotient(Components{})); }
void DepGenerator::write(const Components& components, const std::string& title, const std::string& path) const { StringBuilder output; int indent = 0; output << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; output << "<dsm name='" << title << "'>\n"; indent += INDENT; output.indent(indent); output << "<model>\n"; indent += INDENT; for (unsigned c=0; c<components.size(); c++) { const Component* C = components[c]; if (!showExternals && C->isExternal()) continue; output.indent(indent); output << "<group name='" << C->getName() << "' full='component:" << C->getName() << "' collapsed='0'>\n"; indent += INDENT; const ModuleList& mods = C->getModules(); for (unsigned m=0; m<mods.size(); m++) { writeModule(*mods[m], output, indent); } indent -= INDENT; output.indent(indent); output << "</group>\n"; } indent -= INDENT; output.indent(indent); output << "</model>\n"; indent -= INDENT; output << "</dsm>\n"; FileUtils::writeFile(path.c_str(), path + "deps.xml", output); }