コード例 #1
0
ファイル: ZincModelTest.cs プロジェクト: KommuSoft/ZincOxide
 public void TestGenerateModel2()
 {
     string model1 = string.Empty;
     string model2 = "include \"aninclude\";\n";
     ZincModel zm = new ZincModel ();
     Assert.AreEqual (model1, zm.WriteString ());
     zm.AddItem (new ZincIncludeItem ("aninclude"));
     Assert.AreEqual (model2, zm.WriteString ());
 }
コード例 #2
0
ファイル: ZincModelTest.cs プロジェクト: KommuSoft/ZincOxide
 public void TestGenerateModel1()
 {
     string model01 = string.Empty;
     string model02 = "par int : size;\n";
     string model03 = "par int : size;\npar array [ par 1 .. size , par 1 .. size ] of par int : d;\n";
     ZincModel zm = new ZincModel ();
     Assert.AreEqual (model01, zm.WriteString ());
     ZincIdent size = new ZincIdent ("size");
     zm.AddItem (new ZincVarDeclItem (new ZincTypeInstExprAndIdent (new ZincTypeInstBaseExpression (new ZincScalarType (ZincScalar.Int)), size)));
     Assert.AreEqual (model02, zm.WriteString ());
     ZincTypeInstBaseExpression range = new ZincTypeInstBaseExpression (new ZincTypeInstRangeExpression (new ZincIntLiteral (1), size));
     ZincIdent d = new ZincIdent ("d");
     zm.AddItem (new ZincVarDeclItem (new ZincTypeInstExprAndIdent (new ZincTypeInstBaseExpression (new ZincTypeInstArrayExpression (new ZincTypeInstBaseExpression (new ZincScalarType (ZincScalar.Int)), range, range)), d)));
     Assert.AreEqual (model03, zm.WriteString ());
 }