Example #1
0
		// Override doCell to handle the 'Code' column. We compile
		// the code and optionally load and run the tests.
		public override void doCell(fit.Parse cell, int columnNumber)
		{
			base.doCell (cell, columnNumber);

			FieldInfo field = columnBindings[columnNumber].field;
			if ( field != null && field.Name == "Code" && CompileCodeSnippet( cell, Code ) )
				LoadAndRunTestAssembly( cell, testAssembly );
		}
		public override void doTable(fit.Parse table)
		{
			table.parts.more =
				tr( td( "platform", td( Environment.OSVersion.ToString(), null ) ),
				tr( td( "clrVersion", td( Environment.Version.ToString(), null ) ),
				null ) );
				
		}
Example #3
0
		// Override doCell to handle the 'Code' column. We compile
		// the code and optionally load and run the tests.
		public override void doCell(fit.Parse cell, int columnNumber)
		{
			base.doCell (cell, columnNumber);

			FieldInfo field = columnBindings[columnNumber].field;
			if ( field != null && field.Name == "Assembly" )
				LoadAndRunTestAssembly( cell, Assembly );
		}
 public override object Get(fit.Fixture fixture)
 {
     if (environment.SupportsReturnOnInsert)
         throw new ApplicationException(environment.GetType() + 
             " supports return on insert, IdRetrievalAccessor should not be used");
     DbCommand cmd = environment.CreateCommand(environment.IdentitySelectStatement, CommandType.Text);
  //   Console.WriteLine(environment.IdentitySelectExpression);
     object value = cmd.ExecuteScalar();
     value=Convert.ChangeType(value, expectedType);
     //Console.WriteLine("value=" + value + " of " + value.GetType());
     return (DBNull.Value.Equals(value) ? null : value);
 }
Example #5
0
    public static void Main()
    {
        vector time = new vector(new double[] { 1, 2, 3, 4, 6, 9, 10, 13, 15 });
        vector A    = new vector(new double[] { 117, 100, 88, 72, 53, 29.5, 25.2, 15.2, 11.1 });
        vector dA   = new vector(A.size);

        dA = 0.05 * A;

        // Transform y = a*exp(-lambda * t) --> ln(y) = ln(a) - lambda*t
        for (int i = 0; i < A.size; i++)
        {
            dA[i] = dA[i] / A[i];
            A[i]  = Log(A[i]);
        }

        Func <double, double>[] funcs = new Func <double, double>[] { x => 1, x => x };


        TextWriter dataWriter = Error;

        fit    fitresult = qrfit.qrfitting(time, A, dA, funcs);
        vector cErrors   = fitresult.getParamErrors();

        double a         = Exp(fitresult.c[0]);
        double lambda    = -fitresult.c[1];
        double aErr      = cErrors[0];
        double lambdaErr = cErrors[1];

        WriteLine("----- Problem A -----");
        fitresult.c.print("Parameters:");
        WriteLine($"Acording to these paramaters, a = {a} and lambda = {lambda}");
        WriteLine($"This gives a half life of {Log(2) / lambda} days");
        WriteLine($"The half life of Ra224 is actually 3.6319 days");
        WriteLine("");
        WriteLine("----- Problem B -----");
        fitresult.cov.print("The covariance matrix:");
        cErrors.print("The errors are for the parameters are:");
        WriteLine($"The half life of Ra224 is then estimated to {Log(2) / lambda} +- {-Log(2)/Pow(lambda, 2) * lambdaErr}");

        for (double x = 0; x < 22; x += 1.0 / 16)
        {
            dataWriter.WriteLine($"{x}	{Exp(fitresult.eval(x))}");
            TextWriter answerWriter = Out;
        }
    }
Example #6
0
		protected void LoadAndRunTestAssembly( fit.Parse cell, string testAssembly )
		{
			testRunner = new TestDomain();

			if ( !testRunner.Load( new TestPackage(testAssembly) ) )
			{
				this.wrong(cell);
				cell.addToBody( string.Format( 
					"<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testAssembly ) );

				return;
			}

			testResult = testRunner.Run(NullListener.NULL);
			testSummary = new ResultSummarizer( testResult );

			this.right( cell );
		}
        public set_page()
        {
            view = new fit();
            InitializeComponent();
            //使用task,后台加密,保存
            //转入后台,加密保存
            //新建文件

            //锁
            //失去前台,锁

            //德熙加密
            //一元 js

            //des
            //优先德熙
            //备份
        }
Example #8
0
 public override void DoTable(fit.Parse theTable)
 {
     if (Args.Length>0){
         String requestedEnv=Args[0].ToUpper().Trim();
     /*                if ("ORACLE".Equals(requestedEnv))
             env = new OracleEnvironment();
         else if ("SQLSERVER".Equals(requestedEnv))
             env = new SqlServerEnvironment();
         else if ("SQLSERVER2000".Equals(requestedEnv))
             env = new SqlServer2000Environment();
         else if ("DB2".Equals(requestedEnv))
             env = new DB2Environment();
      */
         throw new ApplicationException("DB Environment not supported " + requestedEnv);
         //DbEnvironmentFactory.DefaultEnvironment=env;
         //this.mySystemUnderTest=env;
     }
     base.DoTable(theTable);
 }
Example #9
0
 public override void DoTable(fit.Parse theTable)
 {
     if (Args.Length>0){
         String requestedEnv=Args[0].ToUpper().Trim();
     IDbEnvironment env;
     if ("ORACLE".Equals(requestedEnv))
       env = MakeEnvironment("dbfit.OracleEnvironment");
     else if ("SQLSERVER".Equals(requestedEnv))
       env = MakeEnvironment("dbfit.SqlServerEnvironment");
     else if ("SQLSERVER2000".Equals(requestedEnv))
       env = MakeEnvironment("dbfit.SqlServer2000Environment");
     /*  else if ("DB2".Equals(requestedEnv))
       env = Processor.Create("DB2Environment", new TreeList<Cell>()); */
     else
       throw new ApplicationException("DB Environment not supported " + requestedEnv);
         DbEnvironmentFactory.DefaultEnvironment=env;
         mySystemUnderTest=DbEnvironmentFactory.DefaultEnvironment;
     }
     base.DoTable(theTable);
 }
Example #10
0
		private bool CompileCodeSnippet( fit.Parse cell, string code )
		{
			TestCompiler compiler = new TestCompiler( 
				new string[] { "system.dll", "nunit.framework.dll" }, 
				testAssembly );

			CompilerResults results = compiler.CompileCode( code );
			if ( results.NativeCompilerReturnValue == 0 )
				return true;

			cell.addToBody( "<font size=-1 color=\"#c08080\"><i>Compiler errors</i></font>" );

			wrong( cell );
			cell.addToBody( "<hr>" );
				
			foreach( string line in results.Output )
				cell.addToBody( line + "<br>" );

			return true;
		}
		 public override void DoTable(fit.Parse theTable)
		 {
			if (Args.Length>0){
				IDbEnvironment env;
				String requestedEnv=Args[0].ToUpper().Trim();
                if ("ORACLE".Equals(requestedEnv))
                    env = new OracleEnvironment();
                else if ("SQLSERVER".Equals(requestedEnv))
                    env = new SqlServerEnvironment();
                else if ("SQLSERVER2000".Equals(requestedEnv))
                    env = new SqlServer2000Environment();
                else if ("DB2".Equals(requestedEnv))
                    throw new ApplicationException("Moved DB2 Environment to dbfit.DB2 assembly. Need to instantiate here.");
                //env = new DB2Environment();
                else if ("MYSQL".Equals(requestedEnv)) 
                    env = Activator.CreateInstance(Type.GetType("dbfit.MySqlEnvironment, dbfit.MySql")) as IDbEnvironment;

                else throw new ApplicationException("DB Environment not supported " + requestedEnv);
				DbEnvironmentFactory.DefaultEnvironment=env;
				this.mySystemUnderTest=env;
			}
			base.DoTable(theTable);
		 }        
Example #12
0
		public override void wrong(fit.Parse cell)
		{
			string body = cell.body;
			base.wrong (cell);
			cell.body = body;
		}
Example #13
0
 public override void DoTable(fit.Parse table)
 {
     SetParameterValue(Args[0], GetArgumentInput(1, typeof(object)));
 }
Example #14
0
		public override void DoCell(fit.Parse cell, int columnNumber)
		{
            fit.Configuration.Instance.Namespaces.Remove(cell.Text);
		}
		private fit.Parse tr( fit.Parse parts, fit.Parse more) 
		{
			return new fit.Parse ("tr", null, parts, more);
		}
 public override void Set(fit.Fixture fixture, object value)
 {
 }
		private fit.Parse td(string body, fit.Parse more) 
		{
			return new fit.Parse ("td", info(body), null, more);
		}