public void LocalWinCmdLineLocalIncludeFile() { // Write out the local include file. The system should pick it up from here. using (var writer = File.CreateText("bogus_function.h")) { writer.WriteLine("int bogus() { return 15; }"); writer.WriteLine(); writer.Close(); } // Run on ints, though for this test it won't matter. var rootFile = TestUtils.CreateFileOfInt(10); // Run the special function. var q = new QueriableDummy <TestNtupe>(); var listing = from evt in q where CPPHelperFunctions.ReturnCustomFuncValue() > 10.0 select evt; var dude = listing.Count(); var query = DummyQueryExectuor.LastQueryModel; // Run the execution environment. var exe = new TTreeQueryExecutor(new[] { rootFile.AsLocalWinUri() }, "dude", typeof(ntuple), typeof(TestNtupe)); exe.CleanupQuery = false; int result = exe.ExecuteScalar <int>(query); Assert.AreEqual(10, result); }
public void TestScope() { // Make sure that if anything funky needs to be done outside our loop, // it gets declared correctly. var q = new QueriableDummy <ntupArray>(); var results = from evt in q select evt.run.PairWiseAll((r1, r2) => CPPHelperFunctions.Calc(r1) != r2).Count(); var total = results.Aggregate(0, (seed, val) => seed + val); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); // // The *2 should be burried in the loop. However, we've seen it popped up to the top // in a bug. So test for that regression. // var seen2 = DummyQueryExectuor.FinalResult.CodeBody.Statements.Where(s => s is StatementSimpleStatement).Cast <StatementSimpleStatement>().Where(s => s.ToString().Contains("]*2")).Any(); Assert.IsFalse(seen2, "Saw a ']*2' in a top level code statement!"); }