/// <summary> /// Merge the common configuration and should/may configuration file. /// </summary> /// <param name="site">An instance of interface ITestSite which provides logging, assertions, /// and adapters for test code onto its execution context.</param> public static void MergeConfigurationFile(TestTools.ITestSite site) { site.DefaultProtocolDocShortName = "MS-FSSHTTP-FSSHTTPB"; // Get the name of common configuration file. string commonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", site); // Merge the common configuration. Common.MergeGlobalConfig(commonConfigFileName, site); // Merge the MS_FSSHTTP-FSSHTTPB should/may configuration file. Common.MergeSHOULDMAYConfig(site); }
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Pass ITestSite to adapter, make adapter can use ITestSite's function</param> public override void Initialize(TestTools.ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-OXWSATT"; Common.MergeConfiguration(testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string password = Common.GetConfigurationPropertyValue("UserPassword", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string url = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); this.exchangeServiceBinding = new ExchangeServiceBinding(url, userName, password, domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// Implements Microsoft.Protocols.TestTools.IAdapter.Initialize(Microsoft.Protocols.TestTools.ITestSite). /// </summary> /// <param name="testSite">The test site instance associated with the current adapter.</param> public override void Initialize(TestTools.ITestSite testSite) { base.Initialize(testSite); string commonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", testSite); Common.MergeGlobalConfig(commonConfigFileName, testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string password = Common.GetConfigurationPropertyValue("UserPassword", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string url = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); this.exchangeServiceBinding = new ExchangeServiceBinding(url, userName, password, domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Pass ITestSite to adapter, make adapter can use ITestSite's function.</param> public override void Initialize(TestTools.ITestSite testSite) { // Initialize. base.Initialize(testSite); Common.MergeConfiguration(testSite); // Get the parameters from configuration files. string userName = Common.GetConfigurationPropertyValue("OrganizerName", testSite); string password = Common.GetConfigurationPropertyValue("OrganizerPassword", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string urlFormat = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); // Initialize service. this.exchangeServiceBinding = new ExchangeServiceBinding(urlFormat, userName, password, domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Pass ITestSite to adapter, make adapter can use ITestSite's function.</param> public override void Initialize(TestTools.ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-OXWSBTRF"; // Merge common configuration and SHOULD/MAY configuration files Common.MergeConfiguration(testSite); // Get the parameters from configuration files. this.userName = Common.GetConfigurationPropertyValue("UserName", testSite); this.password = Common.GetConfigurationPropertyValue("UserPassword", testSite); this.domain = Common.GetConfigurationPropertyValue("Domain", testSite); this.url = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); this.exchangeServiceBinding = new ExchangeServiceBinding(this.url, this.userName, this.password, this.domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Pass ITestSite to adapter, make adapter can use ITestSite's function.</param> public override void Initialize(TestTools.ITestSite testSite) { base.Initialize(testSite); // Merge the common configuration into local configuration string commonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", testSite); Common.MergeGlobalConfig(commonConfigFileName, testSite); // Get the parameters from configuration files. string userName = Common.GetConfigurationPropertyValue("Sender", testSite); string password = Common.GetConfigurationPropertyValue("SenderPassword", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string urlFormat = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); // initialize service. this.exchangeServiceBinding = new ExchangeServiceBinding(urlFormat, userName, password, domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Pass ITestSite to adapter, make adapter can use ITestSite's function.</param> public override void Initialize(TestTools.ITestSite testSite) { // Initialize. base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-OXWSFOLD"; // Merge the common configuration into local configuration. Common.MergeConfiguration(testSite); // Get the parameters from configuration files. string userName = Common.GetConfigurationPropertyValue("User1Name", testSite); string password = Common.GetConfigurationPropertyValue("User1Password", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string urlFormat = Common.GetConfigurationPropertyValue("ServiceUrl", testSite); // Initialize service. this.exchangeServiceBinding = new ExchangeServiceBinding(urlFormat, userName, password, domain, testSite); Common.InitializeServiceBinding(this.exchangeServiceBinding, testSite); }
/// <summary> /// This method is used to analyze the chunk for the RDC analysis chunk method. /// </summary> /// <param name="rootNode">Specify the root node object which is needed to be analyzed.</param> /// <param name="site">Specify the ITestSite instance.</param> public override void AnalyzeChunking(RootNodeObject rootNode, TestTools.ITestSite site) { List<IntermediateNodeObject> expectList = this.Chunking(); foreach (IntermediateNodeObject nodeObject in rootNode.IntermediateNodeObjectList) { IntermediateNodeObject expect = expectList.First(); if (!expect.Signature.Equals(nodeObject.Signature)) { site.Assert.Fail("For the RDC chunk method expect the signature {0}, actual signature {1}", expect.ToString(), nodeObject.Signature.ToString()); } if (expect.DataSize.DataSize != nodeObject.DataSize.DataSize) { site.Assert.Fail("For the RDC chunk method expect the chunk size, actual chunk size {1}", expect.DataSize.DataSize, nodeObject.DataSize.DataSize); } expectList.RemoveAt(0); } // If runs here, then all the requirements related for RDC analysis can be captured. MsfsshttpdCapture.VerifyRdcAnalysisChunk(SharedContext.Current.Site); }
public static string ProcessMaximizeSalary6(string inStr) => TestTools.Process(inStr, (Func <long, long[], string>)MaximizeSalary6);
public static string ProcessCollectingSignatures4(string inStr) => TestTools.Process(inStr, (Func <long, long[], long[], long>)CollectingSignatures4);
private void RunTest(Processor p) { TestTools.RunLocalTest("A7", p.Process, p.TestDataName, p.Verifier, VerifyResultWithoutOrder: p.VerifyResultWithoutOrder, excludedTestCases: p.ExcludedTestCases); }
public override string Process(string inStr) => TestTools.Process(inStr, (Func <long, long[][], long, long, long>)Solve);
public void SparqlPropertyPathParser() { //Load our test data TripleStore store = new TripleStore(); Graph g = new Graph(); FileLoader.Load(g, "InferenceTest.ttl"); store.Add(g); List <String> testQueries = new List <string>(); String rdfsPrefix = "PREFIX rdfs: <" + NamespaceMapper.RDFS + ">\n"; //Cardinality Paths testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf* <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf+ <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf? <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf{2,4} <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf{2,} <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf{,4} <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf{2} <http://example.org/vehicles/Vehicle>}"); //Simple Inverse Paths testQueries.Add(rdfsPrefix + "SELECT * WHERE {?type ^a ?entity}"); //Sequence Paths testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf / rdfs:subClassOf <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf{2} / rdfs:subClassOf <http://example.org/vehicles/Vehicle>}"); //testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf / rdfs:subClassOf{2} <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass a / rdfs:subClassOf <http://example.org/vehicles/Plane>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?vehicle a ^ rdfs:subClassOf <http://example.org/vehicles/Plane>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass a / ^ rdfs:subClassOf <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?entity a ^ a ?type}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?entity a ^ a / rdfs:subClassOf <http://example.org/vehicles/GroundVehicle>}"); //Alternative Paths testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf | a <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass (rdfs:subClassOf | a) | rdfs:someProperty <http://example.org/vehicles/Vehicle>}"); testQueries.Add(rdfsPrefix + "SELECT * WHERE {?subclass rdfs:subClassOf | a | rdfs:someProperty <http://example.org/vehicles/Vehicle>}"); SparqlQueryParser parser = new SparqlQueryParser(); foreach (String query in testQueries) { //Parse the Query and output to console SparqlQuery q = parser.ParseFromString(query); Console.WriteLine(q.ToString()); //Now we'll try and evaluate it (if this is possible) try { Object results = store.ExecuteQuery(q); Console.WriteLine("Evaluated OK"); TestTools.ShowResults(results); Console.WriteLine(); } catch (RdfQueryException queryEx) { Console.WriteLine("Unable to evaluate:"); Console.WriteLine(queryEx.Message); Console.WriteLine(queryEx.StackTrace); } } }
static void Main(string[] args) { if (!Directory.Exists("unoptimizedPrograms")) { Directory.CreateDirectory("unoptimizedPrograms"); } List <perf_data> unoptimizedDatas = new List <perf_data>(); List <perf_data> optimizedDatas = new List <perf_data>(); List <perf_data> optimizedNoGCDatas = new List <perf_data>(); int nameID = 0; Random random = new Random(15231); TestTools tools = new TestTools(); for (int i = 0; i < 2000; i++) { try { perf_data unoptimizedData = new perf_data(); perf_data optimizedData = new perf_data(); perf_data optimizedNoGCData = new perf_data(); JSProgram program = new JSProgram(); program.Render = false; tools.ClearWorkspace(); program.CreateCDFG(3, 15, random); tools.ExecuteJS(program); string xml = tools.GetWorkspaceString(); var result = XmlParser.Parse(xml); if (result.Item2.Count > 0) { i--; continue; } int testCount = 5; float[] untimes = new float[testCount]; float[] optimes = new float[testCount]; Stopwatch watch = new Stopwatch(); for (int z = 0; z < testCount; z++) { watch.Reset(); watch.Start(); TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = false; programExecutor.EnableGarbageCollection = false; programExecutor.Run(100, 100, result.Item1, false); unoptimizedData.makespan = commandExecutor.ticks; watch.Stop(); untimes[z] = watch.ElapsedMilliseconds / (float)testCount; } { int minSize = 10; while (true) { try { result.Item1.Nodes.ForEach(x => x.dfg.Nodes.ForEach(qq => qq.value.Reset())); TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = false; programExecutor.EnableGarbageCollection = false; programExecutor.Run(minSize, minSize, result.Item1, false); break; } catch (Exception e) { if (minSize > 100) { Console.Write(e.Message + Environment.NewLine + e.StackTrace); } minSize++; } } unoptimizedData.size = minSize; } for (int z = 0; z < testCount; z++) { watch.Reset(); watch.Start(); TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = true; programExecutor.EnableGarbageCollection = true; programExecutor.Run(100, 100, result.Item1, false); optimizedData.makespan = commandExecutor.ticks; watch.Stop(); optimes[z] = watch.ElapsedMilliseconds / (float)testCount; } { int minSize = 10; while (true) { try { result.Item1.Nodes.ForEach(x => x.dfg.Nodes.ForEach(qq => qq.value.Reset())); TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = true; programExecutor.EnableGarbageCollection = true; programExecutor.Run(minSize, minSize, result.Item1, false); break; } catch (Exception) { minSize++; } } optimizedData.size = minSize; } { TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = true; programExecutor.EnableGarbageCollection = false; programExecutor.Run(100, 100, result.Item1, false); optimizedNoGCData.makespan = commandExecutor.ticks; } { int minSize = 10; while (true) { try { result.Item1.Nodes.ForEach(x => x.dfg.Nodes.ForEach(qq => qq.value.Reset())); TestCommandExecutor commandExecutor = new TestCommandExecutor(); ProgramExecutor <string> programExecutor = new ProgramExecutor <string>(commandExecutor); programExecutor.TimeBetweenCommands = 0; programExecutor.EnableOptimizations = true; programExecutor.EnableGarbageCollection = false; programExecutor.Run(minSize, minSize, result.Item1, false); break; } catch (Exception) { minSize++; } } optimizedNoGCData.size = minSize; } unoptimizedData.time = untimes.Min(); optimizedData.time = optimes.Min(); unoptimizedDatas.Add(unoptimizedData); optimizedDatas.Add(optimizedData); optimizedNoGCDatas.Add(optimizedNoGCData); string path = Path.Combine("unoptimizedPrograms", $"program_{nameID++}.bc"); File.WriteAllText(path, xml); } catch (Exception e) { //Console.Write(e.Message + Environment.NewLine + e.StackTrace); i--; } Console.WriteLine(i); } tools.AssemblyCleanup(); File.WriteAllText("unoptimized_data.txt", String.Join(Environment.NewLine, unoptimizedDatas.Select(x => x.makespan + " " + x.time.ToString(CultureInfo.InvariantCulture) + " " + x.size))); File.WriteAllText("optimized_data.txt", String.Join(Environment.NewLine, optimizedDatas.Select(x => x.makespan + " " + x.time.ToString(CultureInfo.InvariantCulture) + " " + x.size))); File.WriteAllText("optimized_no_gc_data.txt", String.Join(Environment.NewLine, optimizedNoGCDatas.Select(x => x.makespan + " " + x.size))); }
public void Graded_ImprovingQuickSort3Test() { TestTools.RunLocalTest("A5", Program.ProcessImprovingQuickSort3, "TD3"); }
private void RunTest(String name, String comment, String file, String resultFile, bool?shouldParse) { Console.WriteLine("### Running Test #" + this._count); if (name != null) { Console.WriteLine("Test Name " + name); } if (comment != null) { Console.WriteLine(comment); } Console.WriteLine(); Console.WriteLine("Input File is " + file); if (resultFile != null) { Console.WriteLine("Expected Output File is " + resultFile); } //Check File Exists if (!File.Exists(file)) { Console.WriteLine("Input File not found"); Console.Error.WriteLine("Test " + name + " - Input File not found: " + file); this._fail++; return; } try { var actual = TryParseTestInput(file); if (!shouldParse.HasValue) { Console.WriteLine("Unable to determine whether the test should pass/fail based on manifest information (Test Indeterminate)"); this._indeterminate++; } else if (shouldParse.Value) { Console.WriteLine("Parsed input in OK"); //Validate if necessary if (this.CheckResults && resultFile != null) { if (!File.Exists(resultFile)) { Console.WriteLine("Expected Output File not found"); Console.Error.WriteLine("Test " + name + " - Expected Output File not found: " + resultFile); this._fail++; } else { try { TryValidateResults(name, resultFile, actual); } catch (RdfParseException) { Console.WriteLine("Expected Output File could not be parsed (Test Indeterminate)"); this._indeterminate++; } } } else { Console.WriteLine("No Validation Required (Test Passed)"); this._pass++; } } else { Console.WriteLine("Parsed when failure was expected (Test Failed)"); Console.Error.WriteLine("Test " + name + " - Parsed when failure was expected"); this._fail++; } } catch (RdfParseException parseEx) { if (shouldParse.HasValue && shouldParse.Value) { Console.WriteLine("Parsing failed when success was expected (Test Failed)"); Console.Error.WriteLine("Test " + name + " - Failed to parse when success was expected"); //Repeat parsing with tracing enabled if appropriate //This gives us more useful debugging output for failed tests if (this._parser is ITraceableTokeniser) { try { ((ITraceableTokeniser)this._parser).TraceTokeniser = true; ((IRdfReader)this._parser).Load(new Graph(), Path.GetFileName(file)); } catch { //Ignore errors the 2nd time around, we've already got a copy of the error to report } finally { ((ITraceableTokeniser)this._parser).TraceTokeniser = false; } } TestTools.ReportError("Parse Error", parseEx); this._fail++; } else { Console.WriteLine("Parsing Failed as expected (Test Passed)"); this._pass++; } } Console.WriteLine("### End Test #" + this._count); Console.WriteLine(); this._count++; }
public void Graded_BinarySearch1Test() { TestTools.RunLocalTest("A5", Program.ProcessBinarySearch1, "TD1"); }
public void Graded_MajorityElement2Test() { TestTools.RunLocalTest("A5", Program.ProcessMajorityElement2, "TD2"); }
public static string ProcessMaximizingOnlineAdRevenue3(string inStr) => TestTools.Process(inStr, (Func <long, long[], long[], long>)MaximizingOnlineAdRevenue3);
public static string ProcessMaximizingLoot2(string inStr) => TestTools.Process(inStr, (Func <long, long[], long[], long>)MaximizingLoot2);
public static string ProcessChangingMoney1(string inStr) => TestTools.Process(inStr, (Func <long, long>)ChangingMoney1);
public void ParsingRdfXmlStackOverflow4() { TestTools.RunAtDepth(5000, this.ParsingRdfXmlStackOverflow1); }
public void Graded_NumberofInversions4Test() { TestTools.RunLocalTest("A5", Program.ProcessNumberofInversions4, "TD4"); }
protected void RunManifest(String file, INode[] positiveSyntaxTests, INode[] negativeSyntaxTests) { Assert.True(File.Exists(file), "Manifest file " + file + " not found"); Graph manifest = new Graph(); manifest.BaseUri = BaseUri; try { manifest.LoadFromFile(file); } catch (Exception ex) { TestTools.ReportError("Bad Manifest", ex); Assert.True(false, "Failed to load Manifest " + file); } manifest.NamespaceMap.AddNamespace("rdf", UriFactory.Create("http://www.w3.org/ns/rdftest#")); String findTests = @"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> prefix rdft: <http://www.w3.org/ns/rdftest#> SELECT ?name ?input ?comment ?result ?type WHERE { { ?test mf:action [ qt:data ?input ] . } UNION { ?test mf:action ?input . FILTER(!ISBLANK(?input)) } OPTIONAL { ?test a ?type } OPTIONAL { ?test mf:name ?name } OPTIONAL { ?test rdfs:comment ?comment } OPTIONAL { ?test mf:result ?result } }"; SparqlResultSet tests = manifest.ExecuteQuery(findTests) as SparqlResultSet; Assert.NotNull(tests); foreach (SparqlResult test in tests) { INode nameNode, inputNode, commentNode, resultNode; String name = test.TryGetBoundValue("name", out nameNode) ? nameNode.ToString() : null; inputNode = test["input"]; String input = this.GetFile(inputNode); String comment = test.TryGetBoundValue("comment", out commentNode) ? commentNode.ToString() : null; String results = test.TryGetBoundValue("result", out resultNode) ? this.GetFile(resultNode) : null; //Determine expected outcome //Evaluation tests will have results and should always parse succesfully bool?shouldParse = results != null ? true : false; if (!shouldParse.Value) { //No results declared so may be a positive/negative syntax test //Inspect returned type to determine, if no type assume test should fail INode type; if (test.TryGetBoundValue("type", out type)) { if (positiveSyntaxTests.Contains(type)) { shouldParse = true; } else if (negativeSyntaxTests.Contains(type)) { shouldParse = false; } else { //Unable to determine what the expected result is shouldParse = null; } } } this.RunTest(name, comment, input, results, shouldParse); } }
public void Graded_OrganizingLottery5Test() { TestTools.RunLocalTest("A5", Program.ProcessOrganizingLottery5, "TD5"); }
public void ResetWorkspace() => TestTools.ResetBrowser();
public void Graded_ClosestPoints6() { TestTools.RunLocalTest("A5", Program.ProcessClosestPoints6, "TD6"); }
public void WritingFormattingGraphs() { List <IGraph> graphs = new List <IGraph>(); Graph g = new Graph(); g.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); graphs.Add(g); g = new Graph(); g.LoadFromFile("InferenceTest.ttl"); graphs.Add(g); g = new Graph(); g.LoadFromFile("cyrillic.rdf"); graphs.Add(g); g = new Graph(); g.LoadFromFile("complex-collections.nt"); graphs.Add(g); List <IGraphFormatter> formatters = new List <IGraphFormatter>() { new RdfXmlFormatter() }; List <IRdfReader> parsers = new List <IRdfReader>() { new RdfXmlParser() }; for (int i = 0; i < formatters.Count; i++) { IGraphFormatter formatter = formatters[i]; Console.WriteLine("Using Formatter " + formatter.GetType().ToString()); foreach (IGraph graph in graphs) { Console.WriteLine("Testing Graph " + (graph.BaseUri != null ? graph.BaseUri.ToString() : String.Empty)); StringBuilder output = new StringBuilder(); output.AppendLine(formatter.FormatGraphHeader(graph)); foreach (Triple t in graph.Triples) { output.AppendLine(formatter.Format(t)); } output.AppendLine(formatter.FormatGraphFooter()); Console.WriteLine(output.ToString()); //Try parsing to check it round trips Graph h = new Graph(); IRdfReader parser = parsers[i]; parser.Load(h, new StringReader(output.ToString())); GraphDiffReport diff = graph.Difference(h); if (!diff.AreEqual) { TestTools.ShowDifferences(diff); } Assert.AreEqual(graph, h, "Graphs should be equal after round tripping"); } } Console.WriteLine(); }
public void MainVisualTest() { TestTools.VisualTest(); }
public override string Process(string inStr) => TestTools.Process(inStr, (Func <int, int, double[, ], String>)Solve);
public void ProcessCollectingSignatures4Test() { TestTools.RunLocalTest("A4", Program.ProcessCollectingSignatures4, "TD4"); }
public override string Process(string inStr) => TestTools.Process(inStr, (Func <string[], string[]>)Solve);
/// <summary> /// Overrides IAdapter's Initialize() and sets default protocol short name of the testSite. /// </summary> /// <param name="testSite">Transfer ITestSite into adapter, make adapter can use ITestSite's function.</param> public override void Initialize(TestTools.ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-ASNOTE"; // Merge the common configuration Common.MergeConfiguration(testSite); this.activeSyncClient = new ActiveSyncClient(testSite) { UserName = Common.GetConfigurationPropertyValue("UserName", testSite), Password = Common.GetConfigurationPropertyValue("UserPassword", testSite) }; }
public void InputGradient_1Batch() { Assert.IsTrue(TestTools.VerifyInputGradient(CreateLayer())); }
public static string ProcessMaxmimizeNumberOfPrizePlaces5(string inStr) => TestTools.Process(inStr, (Func <long, long[]>)MaxmimizeNumberOfPrizePlaces5);
public void MaximizeNumberOfPrizePlaces5Test() { TestTools.RunLocalTest("A4", Program.ProcessMaximizeNumberOfPrizePlaces5, "TD5"); }
/// <summary> /// Convert the SegmentDescription struct defined in stack to adapter /// </summary> /// <param name="segmentDescriptionStack">The segments field is composed of a number cSegments /// of SegmentDescription fields. Each SegmentDescription field corresponds to a content segment /// in the order in which they appear in the original content. /// </param> /// <returns>Return the SegmentDescription type defined in adapter</returns> private static SegmentDescription[] ConvertFromStackForSegDescription( TestTools.StackSdk.BranchCache.Pccrc.SegmentDescription[] segmentDescriptionStack) { Microsoft.Protocols.TestSuites.Pchc.SegmentDescription[] segmentDescription = new SegmentDescription[segmentDescriptionStack.Length]; for (int i = 0; i < segmentDescription.Length; i++) { segmentDescription[i].CbBlockSize = segmentDescriptionStack[i].cbBlockSize; segmentDescription[i].CbSegment = segmentDescriptionStack[i].cbSegment; segmentDescription[i].SegmentHashOfData = segmentDescriptionStack[i].SegmentHashOfData; segmentDescription[i].SegmentSecret = segmentDescriptionStack[i].SegmentSecret; segmentDescription[i].UllOffsetInContent = segmentDescriptionStack[i].ullOffsetInContent; } return segmentDescription; }
public void MaximizingOnlineAdRevenue3Test() { TestTools.RunLocalTest("A4", Program.ProcessMaximizingOnlineAdRevenue3, "TD3"); }
/// <summary> /// Convert the dwHashAlgo_Values struct defined in stack to adapter /// </summary> /// <param name="stackDwHashValue">The value indicate which hash algorithm to use.</param> /// <returns>Return the dwHashAlgo_Values type defined in adapter</returns> private static DwHashAlgo_Values ConvertFromStackFordwHash( TestTools.StackSdk.BranchCache.Pccrc.dwHashAlgo_Values stackDwHashValue) { DwHashAlgo_Values adapterdwHashValue; adapterdwHashValue = (DwHashAlgo_Values)stackDwHashValue; return adapterdwHashValue; }
public override string Process(string inStr) => TestTools.Process(inStr, (Func <long, double[, ], double[]>)Solve);
public void MaximizeSalary6Test() { TestTools.RunLocalTest("A4", Program.ProcessMaximizeSalary6, "TD6"); }
/// <summary> /// Merge the common configuration and should/may configuration file. /// </summary> /// <param name="site">An instance of interface ITestSite which provides logging, assertions, /// and adapters for test code onto its execution context.</param> protected override void MergeConfigurationFile(TestTools.ITestSite site) { ConfigurationFileHelper.MergeConfigurationFile(site); }
/// <summary> /// Convert the SegmentContentBlocks struct defined in stack to adapter /// </summary> /// <param name="segmentBlocksStack">The blocks field contains a number cSegments of SegmentContentBlocks fields. /// The Nth SegmentContentBlocks field corresponds to the Nth SegmentDescription and hence the Nth content segment. /// </param> /// <returns>Return the SegmentContentBlocks type defined in adapter</returns> private static SegmentContentBlocks[] ConvertFromStackForSegBlocks( TestTools.StackSdk.BranchCache.Pccrc.SegmentContentBlocks[] segmentBlocksStack) { SegmentContentBlocks[] segmentBlocks = new SegmentContentBlocks[segmentBlocksStack.Length]; for (int i = 0; i < segmentBlocksStack.Length; i++) { segmentBlocks[i].BlockHashes = segmentBlocksStack[i].BlockHashes; segmentBlocks[i].Cblocks = segmentBlocksStack[i].cBlocks; } return segmentBlocks; }