repo stringclasses 966
values | path stringlengths 5 283 | license stringclasses 13
values | stars int64 0 3.47k | default_branch stringclasses 15
values | commit_sha stringclasses 966
values | pushed_at stringdate 2015-04-17 10:56:12 2026-07-22 05:29:38 | size_bytes int64 0 1.91M | sha256 stringlengths 64 64 | content stringlengths 0 1.91M |
|---|---|---|---|---|---|---|---|---|---|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSComp2010/Problem2-Invert.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,137 | 443a88f93a154feb3a79b6af26243afc11077bce72a592c71187b83044c803ee | // RUN: %testDafnyForEachResolver "%s"
// VSComp 2010, problem 2, compute the inverse 'B' of a permutation 'A' and prove that 'B' is
// indeed an inverse of 'A' (or at least prove that 'B' is injective).
// Rustan Leino, 31 August 2010.
//
// In the version of this program that I wrote during the week of VSTTE 2... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSComp2010/Problem3-FindZero.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,352 | 1776faf7689d5acd560671d3c1bd3088cf95ca22ff6a9f26372117cfaec2eba3 | // RUN: %testDafnyForEachResolver "%s"
// VSComp 2010, problem 3, find a 0 in a linked list and return how many nodes were skipped
// until the first 0 (or end-of-list) was found.
// Rustan Leino, 18 August 2010.
//
// The difficulty in this problem lies in specifying what the return value 'r' denotes and in
//... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSComp2010/Problem4-Queens.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,117 | 8ce3825399ed4e8ccc2a61b706d2dbf6455d68a65cd413ae91dfc4194d97a6cb | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s"
// VSComp 2010, problem 4, N queens
// Rustan Leino, 31 August 2010, updated 24 March 2011.
//
// In the version of this program that I wrote during the week of VSTTE 2010, I had
// an unproved assumption. In this version, I simply changed the existen... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSComp2010/Problem5-DoubleEndedQueue.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,278 | 35941f4eeddd7324bf3f1b3796ff8f1b046f03eea4028c4d4d93f9766aa1de5b | // RUN: %testDafnyForEachResolver "%s"
// VSComp 2010, problem 5, double-ended queue.
// Rustan Leino, 18 August 2010.
//
// This program employs the standard Valid()/Repr idiom used in the dynamic-frames
// style of specifications, see for example the comment in Problem3-FindZero.dfy.
// Within that idiom, the... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,337 | cc8d764eb88b523fc748d36ab8b499cdc4b540f4e8a1255f464ec0b62f9515b5 | // RUN: %testDafnyForEachResolver "%s"
// Spec# and Boogie and Chalice: The program will be
// the same, except that these languages do not check
// for any kind of termination. Also, in Spec#, there
// is an issue of potential overflows.
// Benchmark1
method Add(x: int, y: int) returns (r: int)
ensu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,437 | 9c8cb09a34a965ef48b97a75d17ae8d3ade26da762d7206ec31c4b38ab6206a1 | // RUN: %testDafnyForEachResolver "%s"
class Benchmark2 {
method BinarySearch(a: array<int>, key: int) returns (result: int)
requires forall i, j :: 0 <= i < j < a.Length ==> a[i] <= a[j]
ensures -1 <= result < a.Length
ensures 0 <= result ==> a[result] == key
ensures result == -1 ==> forall... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,709 | 3c5eb2469d2cdb12077549b3d1d8665ef339ae6a21414a3de1dbfdef7a4e513f | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
// Note: We used integers instead of a generic Comparable type, because
// Dafny has no way of saying that the Comparable type's AtMost function
// is total and transitive.
// Note: We couldn't get things to work out if we used the Get method.
/... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b4.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,854 | bb8e2288975d1498c89907d98a6d0e5658bbdf783c31685c408085dc11f39605 | // RUN: %testDafnyForEachResolver "%s"
// Note: We are using the built-in equality to compare keys.
//
// The implementation uses a linked list, which isn't the most efficient
// representation of a dictionary. However, for the benchmark, it shows
// that the specification can use mathematical sequences while... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b5.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,512 | 3e9493537ea8ae4484c170514ef408e0dc7865298c7db7f81e7769e729ba149a | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
class Queue<T(0)> {
var head: Node<T>;
var tail: Node<T>;
ghost var contents: seq<T>;
ghost var footprint: set<object>;
ghost var spine: set<Node<T>>;
ghost function Valid(): bool
reads this, footprint;
{
this in footp... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b6.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,803 | bac110b516f485d1c5bde537ec042beb8156b1fd77e64a02779c3c682a726f55 | // RUN: %testDafnyForEachResolver "%s"
class Collection<T> {
ghost var footprint:set<object>
var elements:seq<T>
ghost predicate Valid()
reads this, footprint
{
this in footprint
}
method GetCount() returns (c:nat)
requires Valid()
{
c:=|elements|;
}
method Init... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b7.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,239 | eed2f8c130e5700d819841f23b7234187d276d693e7bf8c74fca92765b9780be | // RUN: %testDafnyForEachResolver "%s" -- --allow-deprecation
// Edited B6 to include GetChar and PutChar
//This is the Queue from Benchmark 3.
//restriction:we assume streams are finite
//what else can we specify?
class Queue<T> {
var contents: seq<T>;
method Init()
modifies this;
ensu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/VSI-Benchmarks/b8.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 8,775 | 824814fb0425e799fd7f90202ca5efea2e4134a991d82351b80e4c2bc36c93c9 | // RUN: %verify --relax-definite-assignment --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Benchmark 8
// A dictionary is a mapping between words and sequences of words
// to set up the dictionary in main we will read a stream of words and put them into the mapping - the first element of the strea... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/BreadthFirstSearch.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,926 | 6eb071c58701fdd6406ebbbe851a552b1a79d7626894b66ca77aee43a4ea966d | // RUN: %testDafnyForEachResolver "%s"
class BreadthFirstSearch<Vertex(==)>
{
// The following function is left uninterpreted (for the purpose of the
// verification problem, it can be thought of as a parameter to the class)
function Succ(x: Vertex): set<Vertex>
// This is the definition of what it ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/Combinators.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 18,066 | 157c9e086c704e073b3e5db505cacd804fdb8a755622c37f55eb3c2b64c68995 | // RUN: %verify --relax-definite-assignment --allow-deprecation "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Problem 2 concerns an interpreter for the language of S and K combinators.
// -----------------------------------------------------------------------------
// Definitions
// First, we define the lang... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/RingBuffer.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,548 | b0031bdcdf3ad8e72a615c2281cb4fae2b6d94ec23d0b8e090879d074b22a9d2 | // RUN: %testDafnyForEachResolver "%s"
class RingBuffer<T(0)>
{
// public view of the class:
ghost var Contents: seq<T> // the contents of the ring buffer
ghost var N: nat // the capacity of the ring buffer
ghost var Repr: set<object?> // the set of objects used in the implementation
// privat... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/RingBufferAuto.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,618 | 0cc176379213a0ebe4b6cf58260ed424451ccfb3f97360bd0f2c1b3142d9161a | // RUN: %testDafnyForEachResolver "%s"
class {:autocontracts} RingBuffer<T(0)>
{
// public view of the class:
ghost var Contents: seq<T> // the contents of the ring buffer
ghost var N: nat // the capacity of the ring buffer
// private implementation:
var data: array<T>
var start: nat
var ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/Tree.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,250 | 0353a168ba9b1f60bb9fca99d622be2f20a7eb4fb96d6a86f1bf7cf2bc44aecc | // RUN: %testDafnyForEachResolver "%s"
// The tree datatype
datatype Tree = Leaf | Node(Tree, Tree)
// This datatype is used for the result of the build functions.
// These functions either fail or yield a tree. Since we use
// a side-effect free implementation of the helper
// build_rec, it also has to y... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/vstte2012/Two-Way-Sort.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,961 | 86ed0762d51dd0241ba72ed88885ea63521c935014ea36fa302f13c7ab0a9895 | // RUN: %testDafnyForEachResolver "%s"
// This method is a slight generalization of the
// code provided in the problem statement since it
// is generic in the type of the array elements.
method swap<T>(a: array<T>, i: int, j: int)
requires 0 <= i < j < a.Length
modifies a
ensures a[i] == old(a[j])
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/assign-such-that-antecedent.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 802 | 3b6c8b79c34dc6168a548eca2cbf62736af2514bae91850bc6915d93f6e5f6e0 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// It would be great if Dafny would use a/b as a possible witness when trying to
// establish the existential in M.
method M(a: int, b: int) {
var s :| b != 0 ==> s == a / b; // PREVIOUS WISH: wish granted in PR 6023, which distributes the "b != 0... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/exists-b-exists-not-b.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 306 | 547af0953e5fa6f806faafffaf6f0f0a131c3da23a2bed6146a1a11324792a49 | // RUN: %testDafnyForEachResolver "%s"
// Z3 4.16.0 can now verify these statements (previously a wishlist item).
// Trigger splitting no longer prevents `exists b :: b || not b` from verifying.
method M() {
assert exists b : bool {:nowarn} :: b;
assert exists b : bool {:nowarn} :: !b;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/FuelTriggers.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 615 | 82f9e320ea7b1bef9735c0418cba4f488c3db759aea67f29e449f95242ce12d8 | // RUN: %testDafnyForEachResolver "%s"
// THIS USED TO BE THE CASE:
//
// With the default version of opaque + fuel, the following fails to verify
// because the quantifier in the requires used a trigger that included
// StartFuel_P, while the assert used StartFuelAssert_P. Since P is
// opaque... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/FunctionEquality.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 521 | 35566297910f1484248a66f5a70b5645e79bc0e23e52eb0f882007e8858437fc | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
function Const<A,B>(a : A) : B -> A {
b => a
}
method Main() {
assert (a => b => a) == (u : int) => (v : int) => u;
if * {
assert Const == (u : int) => (v : int) => u; // wish
} else if * {
assert Const<int,int> == (u : int) => ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/git-issue-6158.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,495 | f270085837c903afa04d62cbf730b1432c6880d5969d468eff4cabd3231ae52f | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// The following program previously showed an unsoundness in the Dafny 4.10 / Boogie / Z3 4.12.1
// tool stack. The soundness bug was fixed in Z3 4.16.0, so this program now correctly fails
// to verify (as expected).
function lsb(i: nat)... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/GoModule.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,227 | 1f7c6508a8dabef05bc215b3cc1f8afb368f3163e1a56ad54ca3150726a62bd1 | // NONUNIFORM: Go-specific extern test
// RUN: %exits-with 3 %run --allow-external-contracts --target go "%s" &> "%t"
// RUN: %OutputCheck --file-to-check "%t" "%s"
// CHECK: undefined: m_GoModuleConversions.ParseURL
// This test used to work only because of a questionable Go-only feature
// of mapping a Dafny s... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/naked-function-in-recursive-setting.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 247 | a1f43b803156cdb7198ca209dad2cdd3a093ea1c10bc70eeb706934624c6f835 | // RUN: %exits-with 2 %verify --show-hints "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost function fact(n: int): int
requires n >= 0
{
if n == 0 then
1
else (
assert fact.requires(n-1); //WISH
n * fact(n-1)
)
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/sequences-literals.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,148 | 02a8c6ee88b0cf93cbefd5bea3188132ff43f0786f7bee14c75a2d40a2f3d393 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Note: in the tests below, it could be useful to experiment with the
// following triggers for some of the library axioms:
//
// axiom (forall<T> s0: Seq T, s1: Seq T, x: T ::
// { Seq#Contains(s0, x), Seq#Append(s0, s1) }
// { Seq#Contains(s1,... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/sequences-s0-in-s.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 813 | db47eab7abe11c9012c81995bfa98368ccd442d4c277521c13ff14901ac97d04 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// The following is also due to a weakness in the axiomatization: namely, it is
// not easy to learn, using Dafny's axioms, that "s[0] in s". One can of course
// prove it, but it doesn't come for free.
method InSeqTriggers(s: seq<int>, i: nat)
requ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/expression/functionCall.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 186 | d6cbaf93074363bb19542164b924fe81914257dff8ede9ef54bd877bf339df39 | // RUN: ! %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
function Callee(x: nat): nat {
x
}
method Caller(b: bool) {
var r := Callee(if b then
10 else
-10);
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/functions/constantWithReveal.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 140 | 5b4f0e60afc74166c3129c97211caa478af521916c8d3551510255a9dfa635bc | // RUN: %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
opaque function Foo(x: int): int {
x
}
const C := reveal Foo(); Foo(42) |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/functions/ensuresReporting.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 537 | 3e708b09eac5ceeb1e62eb71821fdf93def0776e61729d0c5569a6b47a8c5b11 | // RUN: ! %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
function ElseError(x: int): int
ensures ElseError(x) == 0
{
if x == 0 then
0
else
1 // error
}
function ThenError(x: int): int
ensures ThenError(x) == 0
{
if x == 0 then
1 // error
else
0
}
function CaseErr... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/focus.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,339 | 368fa3a9e1ccb5d490157935145a48ec8a57688f6e05184f7f055c5e022979cf | // RUN: %verify --type-system-refresh --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
method doFocus1(x: bool) returns (y: int) {
y := 1; // Batch 1 Batch 2
assert y == 1; // Assertion --
if x {
if false {
assert y >= 0; /... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealConstants.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 353 | c97dea7d6bc27d7e8ab883ecc31fedd641d04587a948b66503dfb8c673097ee6 | // RUN: ! %verify --type-system-refresh --bprint=%t.bpl --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
const someConst: nat := 10
method Constant() {
hide *;
assert someConst >= 0; // pass because of nat type
assert someConst > 8; // error, hidden
reveal someConst;
as... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealFunctions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,464 | 9bbc0b3d010718e4e25d292ee55df7549135917a1b349e5decfb59c638c0f1e3 | // RUN: ! %verify --type-system-refresh --allow-axioms --show-hints --isolate-assertions %s --bprint=%t.bpl > %t
// RUN: %diff "%s.expect" "%t"
function P(x: int): bool {
true
}
method HideAndRevealHappyFlow() {
hide *;
if (*) {
reveal P;
assert P(0);
} else {
assert P(0); // erro... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealInBlock.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,891 | 683b1008fc4c9421d018822eb363f46ded11e7d12d8e7b8c32d05861584c4d11 | // RUN: ! %verify --type-system-refresh --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
function P(x: int): bool {
true
}
function Q(): int
requires P(0) {
3
}
method IfScope() {
hide *;
if (*) {
reveal P;
} else {
reveal P;
}
assert P(2); // err... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealInExpression.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,077 | 95e1cbc5f684b60c9f69d9e921d1d1338697d58bceb6380d79f72708d057e579 | // RUN: ! %verify --type-system-refresh --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
function P(x: int): bool {
true
}
function Q(x: int): bool
requires P(0) {
true
}
method RevealExpressionScope()
{
hide *;
var a := (reveal P; assert P(0); true);
assert P(1... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealMethods.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 333 | 391b863734e8c157446af2207fdec55e27a181d8c4e7684eac81a95236209880 | // RUN: ! %verify --type-system-refresh --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
method MethodEnsuresAreHidden() {
hide Bar;
var x := Bar();
if (*) {
reveal Bar;
assert x;
} else {
assert x; // error
}
assert x;
}
method Bar() returns (x: bool) ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealQualified.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 595 | 7d55ca81a29c65003bbb03b2a11a862855c990854f37a6caaf8c68e7089548e1 | // RUN: %resolve --type-system-refresh --allow-axioms %s > %t
// RUN: %diff "%s.expect" "%t"
module Prod {
class Foo {
function P(x: int): bool {
true
}
static function Q(x: int): bool {
true
}
}
method StaticRevealWorks() {
hide *;
reveal Foo.P;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/reveal/revealSubsets.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 808 | 1971ef14b258b1e190f97b09d78ff4ac604c1a8e5b51578b772335049d312885 | // RUN: ! %verify --type-system-refresh --allow-axioms --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
function P(): nat
method Foo(x: nat) {
hide nat;
if (*) {
assert x > 0; // Fails because nat is hidden
} else {
reveal nat;
assert x > 0; // No error
}
var y := P();
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/AssertBy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 523 | e1f4777679c4d9d36fb30b5c626aaf2152294b3f128251f3c4802bbcd6b83b74 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --print:-
method M0(x: int, y: int)
{
assert x == 6; // error
assert y == 8; // error
}
method M1(x: int, y: int)
{
assert x == 6 by {
assume x == 6; // that was easy
assume y == 8; // hey, why not assume some more while we... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignment.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 159 | ccafeb8ac28d8a93c82b7db534f9033ba4a45bc42a6bfd64f1718a8fcfb5b15a | // RUN: %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
method ByWellformedness(x: int) {
var p: int := 3 / x by {
assume {:axiom} x > 0;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignOrReturn.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 286 | bcd4bd1c9662f116f86ca75038e24a70fbc7f3e8bcce559356c4bc60a6442870 | // RUN: %verify %s --standard-libraries=true &> "%t"
// RUN: %diff "%s.expect" "%t"
import opened Std.Wrappers
method ByWellformedness(x: int) returns (r: Option<int>) {
var p: int :- Some(3 / x) by {
assume {:axiom} x > 0;
}
var q: int :- None;
r := Some(4);
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/assignSuchThat.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 292 | 6ca1776025c70e0e795dd708e2ecce2e2998851444d19c90eac0a96a46aa26bb | // RUN: %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
method ByClause(b: bool) {
var r: int :| false by {
assume {:axiom} false;
}
}
function F(x: int): int
method ByClauseSeparateAssignment() {
var a;
a :| F(a) == 2 by {
assume {:axiom} F(10) == 2;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/forallStatement.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 277 | fd20b25d696d5eb36175ad6101c3f2183121eb64d8f2acbd0aa5b1f9c1a5a968 | // RUN: ! %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
predicate P(x: int)
predicate G(x: int)
lemma SplitIntoConjunctOfForalls(x: int)
ensures P(x)
ensures G(x)
{
forall y: int {:trigger P(y), G(y)}
{
SplitIntoConjunctOfForalls(y + 1);
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/localAssignment.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 146 | f7622d54945cc451d7fc28f4d989c9b05f3bd8f11839fe48d7f0d81d52cc4800 | // RUN: ! %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
method AssignToNat(b: bool) {
var r: nat := if b then
10 else
-10;
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/opaqueBlock.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,936 | 4bca317752b7f39965689e6ef78d8ed5c47961adeec8227b587775211eaebd8a | // RUN: ! %verify --standard-libraries=true %s &> "%t"
// RUN: %diff "%s.expect" "%t"
method Foo() returns (x: int)
ensures x > 4
{
x := 1;
var y := 1;
opaque
ensures x > 3
{
x := x + y;
x := x + 2;
}
assert x == 4; // error
x := x + y;
}
method StructuredCommandsIf(t: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/subsetTypes/errorReporting.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 129 | 19d68570039d46c30cb93b194623d7d6d81d7188eca52c47fa6bac3bb9efe0f5 | // RUN: ! %verify %s &> "%t"
// RUN: %diff "%s.expect" "%t"
type ten = x: int | x == 10 witness if true then
11 else
10 |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/files/defaultModuleAndIncludes/root.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 144 | eacb2939315b78461f8e46a4eb64d239c1fc900fdf04d8d126b1d44ecd85a7c2 | // RUN: %verify "%s" &> "%t"
// RUN: %diff "%s.expect" "%t"
include "Inputs/producer.dfy"
class X {
method Bar() {
Foo();
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/files/defaultModuleAndIncludes/Inputs/producer.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 17 | fb797100f5bdb5a66058e9d8fbb4a6114fc0f69778785b9405e9f1f9a8302896 |
method Foo() {} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/calls/CallBy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,397 | 642624d0245bd3c1dd24558944e330beecf8c71a3ec90fb5503c5d7c9944bd34 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --standard-libraries
import opened Std.Wrappers
opaque predicate P() { true }
lemma ProveP() ensures P() {
reveal P();
}
method NeedsP()
requires P()
{}
method NeedsPAndReturns3() returns (r: int)
requires P()
ensures r == 3
{ ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/calls/CallByHide.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 272 | c40cdc84559c8625915c66ab9d95c449bba324c9b9476c8a1586a6a4334f5341 | // RUN: ! %verify --type-system-refresh --isolate-assertions %s > %t
// RUN: %diff "%s.expect" "%t"
predicate P() { true }
method NeedsP()
requires P()
{}
method M()
ensures P()
{
hide P;
NeedsP() by { reveal P(); }
assert P(); // should fail
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/calls/CallByResolution0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 160 | c515872c7632c60622d2e566fb713decd888c509836a41e4723e5b5f6a961bd7 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
method M() {}
method A() {
var i: int := 0;
M() by {
i := 1;
return;
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/statement/calls/CallByResolution1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 186 | 3f666319c6c6e5f53e16b1cf0ff583ae0b36a6582490a91495118d5ff2b7463a | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
method M() {}
method B() {
var i := 0;
while i < 3 {
M() by {
break;
}
i := i + 1;
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/benchmarks/sequence-race/SequenceRace.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,969 | 29a52c4bdbc2ef50b1937ab133352c5a514d804337851ebbb1a71aa18f2d0a64 | // Only because we're calling gradlew rather than gradlew.bat
// UNSUPPORTED: windows
// Ensure trying to use an unsupported translation target results in a clean error message.
// RUN: %exits-with 3 %baredafny translate cs %args "%s" --plugin:DafnyBenchmarkingPlugin.dll > "%t"
// RUN: %diff "%s.expect" "%t"
/... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/blogposts/Inputs/TestGenerationShared.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,078 | 14ea5cd9e7ccfcacf77e2307f23ee2460914bf5ea42f7af111f0c4ed516b97e0 | module Shared {
datatype Color = Black | White
datatype PieceKind = Knight(c: Color) | King(c: Color) | Pawn(c: Color)
datatype Pos = Pos(row: int, col: int)
type ChessPos = pos: Pos | // In this declaration, "|" means "such that"
&& 0 <= pos.row < 8
&& 0 <= pos.col < 8 witness Pos(0, 0) // "witn... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/Inputs/additional.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 127 | 43b29ba34eeb7177412bfcd5dc72dc544df31c63887a261967b6689e9b32494d | type nat32 = x: int32
| x >= 0
type int32 = x: int
| -0x7fff_ffff <= x && x <= 0x7fff_ffff // lower bound is incorrect |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/libraryOption/libraryOption.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 139 | 08bf48df440047cbc4ea50f4704e0355764d16d755b3877f1a4cfca9432f1245 | // RUN: ! %verify --library=%S/Inputs/brokenProducer.dfy "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function Foo(): int {
Bar()
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/notInput.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 88 | c0828ea4d478a6b442b6dcf0209aff96b7ee665024bc018dadd84d497155b9ea | // RUN: echo ""
method Foo() {
var y := 3;
if (true) {
var y := 4;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/projectFile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,332 | e741124cf1e9200c963afbe15375f89ada9ce852cd23b2dbdd6a59c4d9c2a600 | // Invalid value gives error and stops compilation
// RUN: echo '1' >> %t
// RUN: ! %resolve --warn-shadowing=true %S/broken/invalidValue.toml &> "%t"
// RUN: echo '2' >> %t
// A project file can specify input files and configure options
// RUN: ! %resolve "%S/dfyconfig.toml" &>> "%t"
// RUN: echo '3' >> %t
// T... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/projectFileRun.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 267 | 987de287b0f3c55a700a87007e178000179bddda5df74bb52535ba2711d24326 | // NONUNIFORM: we're not testing the execution behavior
// Run works with project files
// RUN: %baredafny run --show-snippets:false --build=Build/temp --warn-shadowing=false --use-basename-for-filename "%S/dfyconfig.toml" > "%t"
// RUN: %diff "%s.expect" "%t"
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/libraryOption/Inputs/brokenProducer.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 32 | ee4e3654153783bcbd1021a77a8384dbab2fa4f6b33c7c4d1285987d3bb1b48e | function Bar(): int {
true
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/badTypes/badTypes.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 88 | 8c3ed2a6ee6861790fd85f2bf1c52139998f7adca33c9cf65c7f9a26341bbc2d | // RUN: echo ""
method Foo() {
var x := 3;
if (true) {
var x := 4;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/base/included.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 168 | 61fd90d6229901acb4de8ecdd0ee4b22a181215ceb088da4ad4357dfdc2b3f8d | // RUN: %resolve %S/Input/high.dfyconfig.toml > %t
// RUN: %diff "%s.expect" "%t"
method Foo(x: int) {
if (x == 0) {
var x := 3;
print x, "\n";
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/noOptions/input.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 192 | d9c470abca35df4d2574d3be78309ae1dbb45c5a7d7f9f9911958f7540e7216d | // RUN: %baredafny resolve --use-basename-for-filename "%S/dfyconfig.toml" > "%t"
// RUN: %diff "%s.expect" "%t"
module NoOptions {
method Main() {
print "Hello, world!\n";
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/src/excluded.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 88 | ea1bda1646af0e9f04247e415db9a047523a326323f1d591fbec520d44d283cf | // RUN: echo ""
method Foo() {
var z := 3;
if (true) {
var z := 4;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/src/input.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 168 | ae51112e28ed0f2d3c9d46bc774fb5f764a10ab21f1ab299ed20ba8d19df6f32 | // RUN: echo ""
method Foo() {
var x := 3;
if (true) {
var x := 4;
}
}
ghost function Bar(): int {
3
}
method Main() {
print "hello";
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/base/Input/nested/excluded.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 33 | 85ed5a473d2b7675126c55ff0c7996819d01f7d76cdccd4117460ee7162ece10 | // RUN: echo ""
complete garbage |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/high/projectAsLibrary.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 946 | deb9fd7f64ac7ee1ce3ebfecc37d577258fa5293fdb1a1abb989b585ff231a18 | // RUN: %resolve --library "%S/../mid/dfyconfig.toml" --library %S/../low/wrappersLib.dfy --allow-warnings --function-syntax 3 %s > "%t"
// RUN: ! %resolve --library "%S/../mid/dfyconfig.toml" --library %S/../low/wrappersLib.dfy --allow-warnings --function-syntax 3 --unicode-char false %s >> "%t"
// RUN: %verify --li... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/low/wrappersLib.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 86 | 361005e61fd622b9b0fca6658d41854d99edb17700edf24e84b3dfa1a1b9e7b3 | // RUN: echo ""
module Wrappers {
datatype Option<+T> = Some(value: T) | None
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/mid/usesLibrary.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 248 | 800754ab11ff9de55a5797110b9a1f2daa245108a39009a8a0c206b8eb425c83 | // RUN: %resolve "%S/dfyconfig.toml" --allow-warnings > "%t"
// RUN: %diff "%s.expect" "%t"
module Consumer {
import opened Wrappers
function MaybeInt(): Option<int> {
Some(42)
}
method AssertFalse() ensures false { }
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/safeMid/usesLibrary.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 203 | c3512e3540ac097c626085061100703b3488bbdb609159e49362c64b8490015e | // RUN: %resolve "%S/dfyconfig.toml" --allow-warnings > "%t"
// RUN: %diff "%s.expect" "%t"
module Consumer {
import opened Wrappers
function MaybeInt(): Option<int> {
Some(42)
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/noIncludes/src/moreNested/moreInput.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 88 | cfa1f991f7ddfe9f21b5bb98940145346597b08d02ec7941801593f013d3788e | // RUN: echo ""
method Bar() {
var x := 3;
if (true) {
var x := 4;
}
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/compile1quiet/CompileRunQuietly.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 693 | 7ab8e27bb52cc483c93ff65e2805c104bcfcf312e9c2d52d7bcc7e02d3af17df | // RUN: %build --target cs "%s" > "%t"
// RUN: dotnet %S/CompileRunQuietly.dll >> "%t"
// RUN: %build --target js "%s" >> "%t"
// RUN: node %S/CompileRunQuietly.js >> "%t"
// RUN: %build --target go "%s" >> "%t"
// RUN: %S/CompileRunQuietly >> "%t"
// RUN: %build --target java "%s" >> "%t"
// RUN: java -cp... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/compile1verbose/CompileAndThenRun.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 752 | 260268f482c0f73ff6b97e3da0c1d4d39e7c4fd0447f933d54d8cecbe7f44596 | // RUN: %build --verbose --target cs "%s" > "%t"
// RUN: dotnet %S/CompileAndThenRun.dll >> "%t"
// RUN: %build --verbose --target js "%s" >> "%t"
// RUN: node %S/CompileAndThenRun.js >> "%t"
// RUN: %build --verbose --target go "%s" >> "%t"
// RUN: %S/CompileAndThenRun >> "%t"
// RUN: %build --verbose --ta... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/compile3/JustRun.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 783 | b1a5cf0242e8cf70598db71d19e40af4b8b024e92654d142c31f3fc315fdd079 | // NONUNIFORM: /compileVerbose:1 output is backend sensitive
// (although the second set of comamnds could be separated out)
// RUN: %run --target cs --verbose "%s" > "%t"
// RUN: %run --target js --verbose "%s" >> "%t"
// RUN: %run --target go --verbose "%s" >> "%t"
// RUN: %run --target java --verbose "%s" >> "%... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/externalImportsAndExports/exportedAndTestExternAssumptions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,165 | 6b0b685d0ab086e9698bcdd09a850be5d37169b6329b640e879204dc6e23f3ab | // This file tests whether it's possible to export Dafny members using {:extern} annotations, AND
// tests whether 'test-assumptions="externs"' adds dynamic contracts to exported members
// RUN: %testDafnyForEachCompiler "%s" --run-fails -- --find-project
predicate Pre(x: int, y: int) {
x > y
}
class Foo {
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/0_IKnowThisMuchIs.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 541 | 35ae91394edb22bfefb3988167f7f5bf546328bcab2a5414cee450055ef586cf | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// An extremely small program intended to be the first target input for
// brand new Dafny compilers. Avoids any use of strings (and therefore sequences)
// but requires representing booleans at runtime and the bare minim... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/1_Calls-F.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 326 | 9b32f7550c13f1af19056fb860b0f848c68f020173feb09d5ee65ce053c0f962 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Calls.dfy serves to facilitate incremental compiler development.
function F(x: int, y: bool): int {
x + if y then 2 else 3
}
method Main() {
var w;
w := F(2, false);
print w, "\n"... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/2_Modules.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 292 | 5166c59fe45a4f71bf518a313c212d422aaae5b06144f4a5cf1de7b152adf8b1 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
module A {
const i: nat := 1
class X {}
}
module B {
const i: nat := 2
module X {
const i: nat := 3
}
}
method Main(){
print A.i, " ", B.i, " ", B.X.i, "\n";
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/3_Calls-As.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 837 | 3745e3353f4729f5e1ff9ac5f5e99c04b6800f80f21c8ce803bfe1d732b598f7 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Calls.dfy serves to facilitate incremental compiler development.
method A0(x: int, y: bool) {
return;
}
method A1(x: int, y: bool) returns (a: int) {
return a;
}
method A2(x: int, y... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/4_Calls-FunctionsValues-Class+NT.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 967 | 2afce5048a29bac81142fa3532f9d7639e90134a4d203b51926d3c55367ca9cb | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Calls.dfy serves to facilitate incremental compiler development.
module FunctionValues {
method Test() {
var c := new Class(5);
var nt: NT := 5;
ApplyAndPrint(c.F);
ApplyAn... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/5_Calls-FunctionsValues-Dt.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 718 | 64e0310d9a8027708a90431a16e6bbed01911d1a2afb82706e18a84837b4f09c | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Calls.dfy serves to facilitate incremental compiler development.
module FunctionValues {
method Test() {
var color := Red;
ApplyAndPrint(color.F);
ApplyAndPrint(color.G);
p... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/6_Calls-VariableCapture.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,781 | 9b45a98a8e0d67ea34d27a3131e5ae79b8f9111964adae0e478f9f2597dca229 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Calls.dfy serves to facilitate incremental compiler development.
method Main()
{
VariableCapture.Test();
}
module VariableCapture {
method Test() {
var f, _ := Capture(15);
p... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/7_Arrays.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,784 | 51c0f6ee3649cf73bb84990df4e2375c8cd36ff6df9d424761febe88ccc1f2cb | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Arrays.dfy serves to facilitate incremental compiler development.
method LinearSearch(a: array<int>, key: int) returns (n: nat)
ensures 0 <= n <= a.Length
ensures n == a.Length || a[n] == k... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/firstSteps/7_Dt_Algebraic.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,124 | b2b9e90bb78c2da988f55162b654ddd92030c77280df90a804a475604c114a17 | // NONUNIFORM: https://github.com/dafny-lang/dafny/issues/4108
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
//
// This fragment of comp/Dt.dfy serves to facilitate incremental compiler development.
datatype List = Nil | Cons(head: int, tail: List)
method Main() {
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/Libraries/consumer.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 647 | f87cc210419169a33523ddcbaf4bb91578706d4c07c2891ecd35019ab1e3c4e6 | // RUN: %translate cs %trargs --allow-warnings --library "%S/Inputs/directLibrary.dfy" --library "%S/Inputs/secondLibrary.dfy" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// RUN: %OutputCheck "%s" --file-to-check="%S/consumer.cs"
// CHECK: GloballyUniqueProducer
// CHECK-NOT: namespace GloballyUniqueProducer
// CHE... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/manualcompile/ManualCompile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,226 | b33fd03590dab18dd282c18626179d5980c095cd450167c7f2e521edb3513d04 | // NONUNIFORM: Highly target language specific
// RUN: %translate cs %trargs --verbose --include-runtime "%s" > "%t"
// RUN: dotnet build %S/ManualCompile.csproj
// RUN: dotnet %S/bin/Debug/net8.0/ManualCompile.dll >> "%t"
// RUN: %translate js %trargs --verbose --include-runtime "%s" >> "%t"
// RUN: node %S/M... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/moduleDatatypeNameCollision/moduleDatatypeNameCollision.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 284 | 0dd48a812279ca06041bc4a3279a7c638363c9384e9312bb53a7dba49ac383e2 | // NONUNIFORM: this fails on Java
// RUN: %run --target go %s > %t
// RUN: %diff "%s.expect" "%t"
module DuplicateName {
const x := 3
}
module ProblemModule {
datatype DuplicateName = DuplicateName
}
import D = DuplicateName
method Main() {
print D.x;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/source.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 625 | 0cdf35dc74d360f123463472c12f2e3ceb4f2716cf85a0c632f69099116b6856 | // RUN: echo 'lit should ignore this file'
method Main() {
InDefaultModule();
var x := new SomeModule.ClassInSomeModule();
print x.x;
}
method InDefaultModule() {
var x := 3;
}
class ClassInDefaultModule { // Extern does not work in JS {:extern "ClassInDefaultModuleCustomName" }
const x: in... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/translateCsharp.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 270 | f7bdc53795d5c79ed2c8312e414ea50102b953402297bf1991652572afd405aa | // RUN: %baredafny translate cs %args %s --outer-module="my.happy" --output=%S/output/translated.cs
// RUN: %OutputCheck --file-to-check %S/output/translated.cs "%s"
// CHECK: namespace my\.happy\.SomeModule {
// CHECK: namespace my\.happy {
include "./source.dfy" |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/translateGo.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 230 | 3c193cf17445b3ab3970c79bbccb24b12fdd4705f37f89bb4a3181c944c4c8a3 | // RUN: %baredafny translate go %args %s --outer-module="my.happy" --output=%S/output/
// RUN: %OutputCheck --file-to-check %S/output/-go/src/.go "%s"
// CHECK: my_happy_SomeModule "my_happy_SomeModule"
include "./source.dfy" |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/translateJava.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 218 | 4049ccd55cc89b9547daf84d0b530d0ac5c39ba45e03402fb837fcc42876f81f | // RUN: %baredafny translate java %args %s --outer-module="my.happy" --output=%S/output/myjava
// RUN: %OutputCheck --file-to-check %S/output/myjava-java/myjava.java "%s"
// CHECK: my\.happy
include "./source.dfy" |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/translateJs.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 230 | 8250141431979aa0958c842581a45544447bab2f1214177cc4dabd308a824599 | // RUN: %baredafny translate js %args %s --outer-module="my.happy" --output=%S/output/js
// RUN: %OutputCheck --file-to-check %S/output/js.js "%s"
// CHECK: let my_happy_SomeModule
// CHECK: my_happy =
include "./source.dfy" |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/outerModules/translatePy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 360 | f9b693eb4c071039a90f3e0530c379488ea8b91b16e32b51e89cc8f6499cf812 | // RUN: %baredafny translate py %args %s --outer-module="my.happy" --output=%S/output/
// RUN: %OutputCheck --file-to-check %S/output/-py/my_happy.py "%s"
// We could update PythonCompiler to it puts every module in a separate folder: %OutputCheck --file-to-check %S/output/-py/my/happy.py "%s"
// CHECK: import my_ha... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/externErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 865 | 7b651464455e3f1fd888ad6d809a6ad8953899c4a2277206a0d98907b2cd8b1c | // RUN: ! %run %s > %t
// RUN: %diff "%s.expect" "%t"
replaceable module {:extern "FooNameOverride"} Foo {
method {:axiom} {:extern "ZazOverride1"} Zaz() returns (i: int)
ensures i >= 2
method {:axiom} {:extern "ZapOverride1"} Zap() returns (i: int)
ensures i >= 2
}
module {:extern "BarNameO... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/replaceableExecutionErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 242 | 1c4f5315cb11eac0b33bd42186fce3c897ff39331333be296565ae717b39acbe | // RUN: ! %baredafny run %args "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
replaceable module NeverReplaced {
method Foo() returns (i: int)
ensures i >= 2
}
method Main() {
var x := NeverReplaced.Foo();
print x, "\n";
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/replaceableHappyflow.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,328 | 1316f1721513fae2a18be2e44e5a472855071c92e02058ad13719991ed0bac89 | // RUN: %testDafnyForEachCompiler "%s"
replaceable module FooModule {
method Foo() returns (i: int)
ensures i >= 2
}
abstract module SuchAbstract {
function OrNot(): int {
1
}
}
replaceable module BarModule refines SuchAbstract {
method Bar() returns (i: int)
ensures i >= 1
}
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/replaceableResolve1Errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 267 | a2b353db56d25d667179c51bf9698d9fb845f97f33f33d4105094e6741b9cb55 | // RUN: ! %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
replaceable module Cycle1 replaces Cycle2 {
}
replaceable module Cycle2 replaces Cycle1 {
}
module DanglingReplacer refines DoesNotExist {
}
module DanglingReplacer2 replaces DoesNotExist {
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/replaceableResolveErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 594 | 70939610442b6abb4824f1ec7d2d6d51feb13f9148cf3a03b09800abc826adcd | // RUN: ! %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
replaceable module FooModule {
method Foo() returns (i: int)
ensures i >= 2
}
module Nesting {
module ConcreteFoo replaces FooModule {
method Foo() returns (i: int) {
return 2;
}
}
}
module FooRefiner refines FooMod... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/replaceables/resolveManyReplacement.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 359 | b3170509da3f2343109dd31516b68c84e3e0c303c8195b62d9aeaf4ce2cf24ea | // RUN: ! %resolve --allow-axioms %s > %t
// RUN: %diff "%s.expect" "%t"
// Currently this creates a resolution error.
replaceable module FooModule {
method Foo() returns (i: int)
ensures i >= 2
}
module Replacement1 replaces FooModule {
method Bar() returns (i: int)
ensures i >= 1
}
modu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/array2d.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 891 | b80df091a22f780544371085dff39f2526420de874317ac781cdd146a0cb5ddc | // NONUNIFORM: Rust-specific tests
// RUN: %baredafny run --target=rs --enforce-determinism "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
var a := new int[3, 4] ((i,j) => 0);
print_array2d(a);
a[0, 0] := 1;
a[0, 1] := 2;
a[0, 2] := 3;
a[0, 3] := 4;
a[1, 0] := 5;
a[1, 1] :... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.