File: ProgramLoader.cs

package info (click to toggle)
boogie 2.4.1%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 19,456 kB
  • sloc: cs: 90,888; python: 183; lisp: 99; sh: 66; makefile: 14
file content (33 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using NUnit.Framework;
using System;
using Microsoft.Boogie;

namespace TestUtil
{
	public class ProgramLoader
	{
		public static Program LoadProgramFrom(string programText, string fileName="file.bpl")
		{
			Assert.IsNotNullOrEmpty (programText);
			Assert.IsNotNullOrEmpty (fileName);


			int errors = 0;
			Program p = null;
			errors = Parser.Parse(programText, fileName, out p, /*useBaseName=*/false);
			Assert.AreEqual(0, errors);
			Assert.IsNotNull(p);

			// Resolve
			errors = p.Resolve();
			Assert.AreEqual(0, errors);

			// Type check
			errors = p.Typecheck();
			Assert.AreEqual(0, errors);

			return p;
		}
	}
}