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/dafny4/git-issue45.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 149 | 35f1b8ce05389aed8a78848efc98be8f64f74139c8233c1da2184f17cb05e8de | // RUN: %testDafnyForEachResolver "%s"
module Library {
}
module Outer {
import Library
module Inner {
import Library
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue46.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 112 | 41e7a7842c7b0c1e30f2c5af2a5edbbbb98f82376f710391bd0db7cd92fea5aa | // RUN: %testDafnyForEachResolver "%s"
include "git-issue46-include.dfyi"
module m4 refines m2 { }
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue47.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 80 | a17dbab8feb4736ba247209d6668101785ffd9930074e3f19eb0b193b8d61865 | // RUN: %testDafnyForEachResolver "%s"
include "git-issue47-include.dfyi"
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue48.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 100 | 9f109266a5e1481fc3e188339699569b395cd3c05a2f645f8eff4b369551cdd6 | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
include "git-issue48-include.dfyi"
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue49.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 151 | ec5573cf397613b2cfa1a940751d2483dcaf7c069d7743542f896835a54cd4a8 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module m1 {
export reveals f
type T = int
ghost function f(x:T) : T { x }
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue5.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,066 | 13a9df59bd56a4b6edfdca33d388df4dcefbeb14bf8583a22178addfe1fc12c3 | // RUN: %testDafnyForEachResolver "%s"
ghost predicate isEven(x:int)
{
x % 2 == 0
}
ghost function f(x:int, y:int): (z:int)
requires x>0 && y > 0
ensures z >= 10
ensures f(x,y) == z
ensures isEven(z)
{
2*(x+y) + 10
}
twostate function P2(x: int) : (z: int)
ensures z == x - 1
ensure... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue50.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 444 | 9f9b6335e08f3d89ab2335d3be043f47ab0a8c1eff2046a8ed5f51cd65b42c60 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module am {
type T
}
module cm1 refines am {
export reveals f
type T = int
ghost function f(i:int) : int { i }
}
module cm2 refines am {
import opened cm1
type T = bool
ghost function g(b:T) : T { !b } // Error incorrectly report... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue51.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,450 | eb49466e4f57ef6c189789843263e8ac9a119215ad420bf93a849ce1d5119bb8 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
class C {
var next: C?
var x: int
}
ghost function F(c: C): int
reads c
{
c.x
}
twostate function G(a: C, new b: C): int
reads b
{
old(a.x) + b.x
}
lemma L(c: C)
{ }
twostate lemma K(a: C, new B: C)
{ }
method M0(p:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue53.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 118 | a8cff4ba0e9790530ccc44c73290b763d1a39df2294773e18e97175f730a996b | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
ghost predicate P() {
forall m:mode :: m == m
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue57.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 158 | abd775251ec45594a45ec73108eb62ea35b7d0ebbf5a362a36699a32a8d1c3fd | // RUN: %testDafnyForEachResolver "%s"
lemma lemma_RotateRightAdds(x:bv32)
ensures (x.RotateRight(2)).RotateRight(3) == x.RotateRight(5)
{
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue59.legacy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 186 | 0b5839707ab61960af5080b9c72adb28712db41663610c335a4a0060e6dfabae | // RUN: %exits-with 4 %dafny /tracePOs /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
include "git-issue59.legacy.dfyi"
method foo(x:byte) {
var y:byte := x+1;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue63.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,021 | b3feb6dd1fdf9065970242c619ad1e4e84b7d904a342dcdaf5a90a63265c601d | // RUN: %verify --relax-definite-assignment --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
type globalsmap = map<string, seq<int>>
ghost predicate {:axiom} ValidGlobal(g:string)
ghost predicate {:opaque} ValidGlobalStateOpaque(globals: globalsmap)
{
forall g :: ValidGlobal(g) <==> g in global... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue64.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 113 | 8a64f05a56b662b96abf67fbbc3568cdacbe9dbc6b295a89511bdd3af778ae22 | // RUN: %testDafnyForEachResolver "%s"
include "git-issue64.dfyi"
ghost function id(x:word): word { x }
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue67.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 543 | bc82517edbef4c9e13fe572b1a84926cafdc1849400099e76c9e5f8ba6bf753e | // RUN: %verify --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Node { }
ghost predicate Q(x: Node)
ghost predicate P(x: Node)
method AuxMethod(y: Node)
modifies y
method MainMethod(y: Node)
modifies y
{
AuxMethod(y); // remove this call and the assertion below goes through (as ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue70.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 717 | 74ba617df91da8a295e3f26719a1173774f24a46e862046791e1950d73cc8dbc | // NONUNIFORM: https://github.com/dafny-lang/dafny/issues/4108
// RUN: %run "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main()
{
mapTest();
imapTest();
}
method mapTest() {
print "map test \n";
var m := map[4 := 5, 6 := 7];
assert (set x | x in m) == m.Keys;
assert (set x | x in m :: m... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue74.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 261 | 434464112f34ecdfde030ac7dede48fa893bca8898d7269a801150f459d85bcf | // RUN: %testDafnyForEachResolver "%s"
function{:opaque} f(x:int):int { x }
lemma L()
ensures forall x:int :: f(x) == x
{
forall x:int
ensures f(x) == x
{
reveal f();
}
assert forall x:int :: f(x) == x;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue75.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 342 | 9d565c56576f92b65e8fb41f47a5b3b9f9f8c35cb6e6f6fcbe5218229b473c37 | // RUN: %verify "%s" --allow-warnings > "%t"
// RUN: %diff "%s.expect" "%t"
type t = i:int | 0 <= i < 10
ghost function f():t
ghost function g():int
lemma L1() returns(m:map<int, t>)
{
m := map i | 0 <= i < 5 :: f(); // FAILS
}
lemma L2() returns(m:map<int, t>)
{
m := map i | 0 <= i < 5 :: [f()... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue76.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 701 | 1390a0e30c5c224e173c5387f47447459ce58cc1b72dd4a27a392456b76437a3 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method Main() {
M0();
M1();
EqualityOfStrings0();
EqualityOfStrings1();
}
// The verification of the following methods requires knowledge
// about the injectivity of sequence displays.
method M0()
{
as... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue79.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,621 | 5c695d3fdc411e054a0a4f630c9b7d96528c20089194e9c29950aa88ab11c553 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
datatype EInt = Int(val: int) | Unknown
type Pair = (string, EInt)
ghost function Inc(p: Pair): Pair
{
match p
case (s, Int(x)) => (s, Int(x + 1))
case (s, Unknown) => (s, Unknown)
}
ghost function Inc2(s1:s... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue88.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 319 | e512dfffca92f526ccc4dc74e98b1dd97613f3058839eb114c955c10848f75fe | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
type Grid = array2<int>
method M2() {
var g: Grid := new int[9,9];
g[0,0] := 1;
}
type Line = array<int>
method M1() {
var g: Line := new int[9];
g[0] := 1;
}
method Main()
{
M2();
M1();
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue90.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 152 | 2129261a63af1a51c86e356fd2a9a48a42dc027e51db959dd740cb949c54d6bc | // RUN: %testDafnyForEachResolver --expect-exit-code 2 "%s"
const x: MyInt := 200
const y: int := x as int + 180
newtype MyInt = k | 0 <= k < y
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue92.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 193 | 0310998b2c66eb1a6e7e6eaaf3e92234874084020aa7ef53ffbc6c30b78c7f3e | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
datatype d = D(i:int)
ghost predicate p(s:int, y:int)
ghost predicate q(d:d) { exists s :: (match d case D(z) => p(s, z)) }
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue96.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 716 | b46d48f4c2a29ad4bed5cf38b506de0cc473546077e15982cf4f928149867b94 | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
ghost predicate P(s:seq<int>)
requires 10 < |s|
{
(forall i:int {:trigger s[i]} :: forall j:int {:trigger s[j]} ::
0 <= i < j < 5 ==> s[i + j] == s[i] == s[j])
}
ghost predicate P0(s:seq<int>)
requires 10 < |s|
{
(forall ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue98.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 464 | 77eeef0a3f8dd16c662cd3297ab411caaa910e16c1a6abf18f904d171c6ced4d | // RUN: %verify --disable-nonlinear-arithmetic "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
abstract module One {
type State
type Action
ghost predicate StateNext(s:State, s':State, a:Action)
ghost predicate StateNextSeq(sseq:seq<State>, actions:seq<Action>)
{
|sseq| == |actions| + 1
&& (... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/git-issue99.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 271 | 1e5e63a99667c3124c0281bfc18bc620ac1113d3fdee10a00127d20829db815c | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module TestModule {
lemma lemma_Test<T1, T2>(x2:T2, s:iset<(T1, T2)>)
requires exists c:BOGUS_TYPE :: (c, x2) in s // error (x2), both resulting from an unidentified type
{
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Issue09.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 688 | fdb92ba3494b81a78e517b8a6315a20f7b9cef1a3a2710dc46cdffdd0e188adb | // RUN: %testDafnyForEachResolver "%s"
ghost function Transform(x:int) : int
lemma TransformProperties()
ensures forall x1, x2 {:trigger Transform(x1), Transform(x2)} :: Transform(x1) == Transform(x2) ==> x1 == x2
ghost function {:opaque} Looper(input:seq<int>) : seq<int>
ensures |Looper(input)| ==... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Juggernaut.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 333 | 846ab95cb330165b5bfc3998a8da8a5f638d3b3bba93e447dbb6604c4cf75255 | // RUN: %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Jug()
{
var x, y, z;
while x > 0 && y > 0 && z > 0
decreases x < y, z
{
if y > x {
y := z;
x := *;
z := x - 1;
} else {
z := z - 1;
x := *;
y := x - 1;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/KozenSilva.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 13,806 | 700ab16329528e829ed8c7010bf121d8c75daf2b151ceafc0a38c9ba3777d7b0 | // RUN: %testDafnyForEachResolver "%s"
// Dafny versions of examples from "Practical Coinduction" by Kozen and Silva.
// The comments in this file explain some things about Dafny and its support for
// co-induction; for a full description, see "Co-induction Simply" by Leino and
// Moskal.
// In Dafny, a co-i... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/LargeConstants.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 258 | e0971d6ff018dfadd06936708282d57e1df3fd6fe0fd722a0f5910c2bd5377dd | // RUN: %testDafnyForEachResolver "%s"
lemma largeIsLarge()
ensures 0x8000000000000000 > 0 {
}
lemma SmallIsSmall()
ensures -0x8000000000000000 < 0 {
}
lemma ShouldCancelOut()
ensures -0x8000000000000000 + 0x8000000000000000 == 0 {
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/LeastGreatest.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,291 | a00572647f0a99648d259adf3ad346c20a29347467bb3b90489bcb9187f43614 | // RUN: %testDafnyForEachResolver "%s"
least predicate Natural(x: int) {
x == 0 || Natural(x - 1)
}
greatest predicate Positive(x: int) {
x != 0 && Positive(x + 1)
}
least lemma NaturalIsNat(x: int)
requires Natural(x)
ensures 0 <= x
{
}
lemma NatIsNatural(x: int)
requires 0 <= x
ens... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Leq.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,091 | 22417ff7cc018a6bb78550e4f581d632a65a56a7c72f1cb7c71f8e661bb3a596 | // UNSUPPORTED: windows, macosx
// RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Rustan Leino, 22 Sep 2015.
// This file considers two definitions of Leq on naturals+infinity. One
// definition uses the least fixpoint, the other the greatest fixpoint.
// Nat repre... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Lucas-down.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,011 | 8bca3745338e3a996b02c8444a55b5b07c8b7a46aa922b7855d0555df9e83d58 | // RUN: %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Proof of the Lucas theorem
// Rustan Leino
// 9 March 2018
//
// Instead of the lemmas doing "up", like:
// P(k) == P(2*k)
// P(k) == P(2*k + 1)
// (see Lucas-up.dfy), the lemmas in this version go "down", like:
// P(k%2) == P(k)
// This... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Lucas-up.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,706 | 586a57c1ed42e8c60570f2829beb0714b82dffac45adea3aa88a981fadf9d2c7 | // RUN: %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Proof of the Lucas theorem, following the structure of a HOL-Light
// proof of the same theorem by John Harrison. The lemmas in this
// version go "up", like:
// P(k) == P(2*k)
// P(k) == P(2*k + 1)
//
// Rustan Leino
// 7 March 2018
// Updat... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/McCarthy91.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,676 | e8b872a5ef6398aaf9681a36564cb19277680f2c85553a3d2a297e73ba919e30 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// The usual recursive method for computing McCarthy's 91 function
method Main() {
var s := [3, 99, 100, 101, 1013];
var n := 0;
while n < |s| {
var m := M(s[n]);
print "M(", s[n], ") = ", m, "\n";
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/MonadicLaws.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,128 | 3ca7cc8eb0bf90f20aa9430d8192abe178b697879c359e1a24c9fd1aac46b36d | // RUN: %testDafnyForEachResolver "%s"
// Monadic Laws
// Niki Vazou and Rustan Leino
// 28 March 2016
datatype List<T> = Nil | Cons(head: T, tail: List)
ghost function append(xs: List, ys: List): List
{
match xs
case Nil => ys
case Cons(x, xs') => Cons(x, append(xs', ys))
}
lemma AppendNil(x... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/NatList.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,756 | 45500bf53da42b3b0a6d130d8d4ea3963f3d2d040f7691d321d86b15e75b34b0 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// This file tests some programs where "nat" is a type parameter to
// a datatype.
datatype List<+T> = Nil | Cons(head: T, tail: List<T>)
method Main() {
var ns := Nil;
ns := Cons(4, Cons(10, Nil));
print "ns ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/NipkowKlein-chapter3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,996 | 8927f5e73d51c6abcb44d9837dce5b7f6237eab9ac580b87f53881fc8269c26c | // RUN: %verify --solver-option="O:smt.qi.eager_threshold=30" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file is a Dafny encoding of chapter 3 from "Concrete Semantics: With Isabelle/HOL" by
// Tobias Nipkow and Gerwin Klein.
// ----- lists -----
datatype List<T> = Nil | Cons(head: T, tail: List<T>)
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/NipkowKlein-chapter7.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 14,097 | 1519e07d13e212f1706346b92c778252d7ef32cf5e7d5eb37db598adf42757ca | // RUN: %verify --manual-triggers "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file is a Dafny encoding of chapter 7 from "Concrete Semantics: With Isabelle/HOL" by
// Tobias Nipkow and Gerwin Klein.
// ----- first, some definitions from chapter 3 -----
datatype List<T> = Nil | Cons(head: T, tail: List... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/NumberRepresentations.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 14,193 | db45135c0fe1e772018720d77de24b83f6f872a35a2b04323c01bfb3eadca541 | // RUN: %testDafnyForEachResolver "%s"
// We consider a number representation that consists of a sequence of digits. The least
// significant digit is stored at index 0.
// For a given base, function eval gives the number that is represented. Note
// that eval can be defined without regard to the sign or magn... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/OpaqueBug.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 762 | 9738abcb0099404e2854ef2164296d0fd845f7f8bb5cb2dc6cf6758b3ba29279 | // RUN: %exits-with 4 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost predicate inner(x:int, y:int) { x == y}
ghost predicate {:opaque} secret(w:int, z:int) { inner(w, z) }
method test(m:int, n:int)
// A previous bug in SplitExpr meant that this mention of secret
// caused its body to be in... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/parse-errors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 687 | d91b8649464d8a612b0b4bbd44c154e4a64922e04fd46d7ce44f5297c88de960 | // RUN: ! %baredafny resolve --show-snippets:false --use-basename-for-filename "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype D = B | CCC | E { predicate IsFailure() { E? } function PropagateFailure(): D { E } }
// Careful: some errors will prevent subsequent ones from begin reported
method m2() returns ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/parse-errors2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 322 | 447eda7e622e17d2324dcca712474ed454f020ea34b375e3e1f3071dbe2e466c | // RUN: ! %baredafny resolve --use-basename-for-filename --show-snippets:false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype D = D(z: int, 2: int)
method m1(s: seq<int>) {
var a := 1 ! ! 1;
var a := 1 ! 1;
}
method m2() {
assert true <== true ==> true ==> true <== true;
assert 1 !! 1 != 1;
}... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/predicateReturnVariable.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 123 | a94fe27a879be19dc8ac823357c217a9533030b0edf49130fbcbeb7e0046dfc4 | // RUN: %testDafnyForEachResolver "%s"
predicate tautology1(x: int): (y: bool)
ensures x == 2 ==> y
{
x >= 2
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/predicateReturnVariableWrong.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 450 | e3c92e97b7762f0e35b50a902d8c7ece001e887209d5ccdc3cd2bb283544f30c | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
ghost predicate tautology1(x: int): (y: int) {
true
}
least predicate tautology2(x: int): (y: int) {
true
}
greatest predicate tautology3(x: int): (y: int) {
true
}
type MyBoolSynonym = bool
ghost predicate tautology1(x: int): (y: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Primes.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,158 | c7d2ed7788c0f4b98e17aaf6e553911672bc0a3898b3536493bb444c19cc90cb | // RUN: %testDafnyForEachResolver "%s"
ghost predicate IsPrime(n: int)
{
2 <= n && forall m :: 2 <= m < n ==> n % m != 0 // WISH It would be great to think about the status of modulo as a trigger
}
// The following theorem shows that there is an infinite number of primes
lemma AlwaysMorePrimes(k: int)
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/regression-calc.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 352 | 9baeadd5f839bd3126efe4e285b77da3a52771691d40b8d832b3617f0323f41b | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// There is a bug in Dafny that causes the error from `L` to be reported at
// position 0 in this file, instead of on a curly brace.
lemma L()
ensures false {
calc { true; }
}
// Empty calc statements work fine, though:
lemma L'()
en... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 509 | 7c884864238b8f8f331dfafcd62e2fbf3890c60c50d20a49a08af7cbcec1819f | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This once crashed Dafny
method M() {
var s := [1, "2"]; // error: all elements must have the same type (type of s not yet determined)
if * {
assert "2" in s; // error: mismatched types (*)
} else if * {
assert exist... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 273 | 8a0497f3e4c2d6c0c555ae0a05cd38e5e346d11544db65544ce011c5cef5c66b | // RUN: %testDafnyForEachResolver "%s" -- --allow-warnings
ghost method M() {
var x :=
// In the following line, why are the range and term copied in Substitute?
// var loo := 100; map y | 0 <= y < 100 :: y+1;
var loo := 100; imap y: int | true :: 3;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression10.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 419 | 4ced6860853e3df1d2611e1c5c3f1b9d83d4a7ad165331f193d93277c8a5dc95 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Once upon a time, the type parameter in the following line had caused
// malformed Boogie to be generated.
type EvenSet<A> = s: set<A> | |s| == 0 || |s| % 2 == 0
method Main()
{
var s: EvenSet := {36,24,36}; // this set only has 2 numbers, so... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression11.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,047 | 2112662390f3c9a3c1ddd1725015a431c982e59d3f5213c31819abfec3d10c4d | // RUN: %exits-with 2 %build "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Once upon a time, several of these would crash the resolver after it had reported
// that an error about an unresolved type name.
class MyClass<O> { }
ghost function F<Y>(x: int, Y: Y): int { x }
type Subset0<A> = x: int | var s:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression12.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,917 | 2f58ce4dccbba7ac7a8bf3bd7ead7adedd3284ed24c04ae164986b506e9dc3bd | // RUN: %exits-with 4 %build --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Some tests for the type inference that was revamped
// to better support subset types.
class VariousArrows {
method Tests()
{
var c := InitArray(F); // fine
var d := InitArray(F'); // fine
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression13.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 809 | 7e1df1bfc2a5b285534289a4a70083c7a59a7b643f613167a938c5c139ae3a2e | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module M0 {
type vname = string
type state = vname -> int
// regression: the following used to lead to a crash and malformed Boogie
lemma L(f: state --> int)
{
L(f); // error: cannot prove termination
}
}
module M1 {
type ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression14.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 536 | 765ddb6d9f86d0807448112c661db53091496cb26ace33320a35930aecce6eeb | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module AAA {
ghost function Func(): int
class MyClass { }
method Get() returns (m: MyClass)
method M()
{
var p := Get();
var x := p.Func(); // error: Func is not in MyClass (this used to crash)
}
}
module BBB {
const D:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression15.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,374 | bbf20d2e5ee6ad0efba88d14858769a8da97bd67287e2f5c55e37a4a7e1beba6 | // NONUNIFORM: https://github.com/dafny-lang/dafny/issues/4108
// RUN: %run --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
var b;
b := M0(); print b, "\n";
b := M1(); print b, "\n";
b := M2(); print b, "\n";
b := M3(); print b, "\n";
b := M4(); print b... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression16.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,535 | 175304f82f32644ede1652453575d7cc8afbbb96a7809a27967643d05f98b883 | // RUN: %testDafnyForEachResolver "%s"
datatype Tree = Leaf | Node(x: int, left: Tree, right: Tree)
function Insert(t: Tree, y: int): Tree
{
match t
case Leaf => Node(y, Leaf, Leaf)
case Node(x, left, right) =>
if y < x then
Node(y, Insert(right, x), left)
else
Node(x, Insert(r... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression17.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 193 | 55a543ec790f8bf03afd93943322ef0dd82a6798879b236edd6cdb6fd1e5b8bc | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
newtype nt = int
method Test(x: int)
{
var y := map[x := nt]; // error (but should not cause a crash): nt is a type
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression18.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 905 | 182a96bfdf69582240888cf4a148ea91a5a82284025b750a5f0eb0b80ee94903 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module A {
type X
}
module B {
import A
type T = A.X
type NewT = t: T | Pred(t) witness Witness()
ghost predicate Pred(t: T)
function Witness(): T
ensures Pred(Witness())
method Bad(x: T) returns (tt: NewT) {
// The ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression19.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,414 | cedd2283d0b9f4f70264a11c683a3721241752443ed768125c4848a13f29122d | // RUN: %testDafnyForEachResolver "%s"
ghost predicate ContainsNothingBut5(s: set<int>)
{
forall q :: q in s ==> q == 5
}
ghost predicate YeahContains5(s: set<int>)
{
exists q :: q in s && q == 5
}
ghost predicate ViaSetComprehension(s: set<int>) {
|set q | q in s && q == 5| != 0
}
ghost pre... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 707 | 500d40e0fca81c9983d0dc5fc436726f9d4a243193b1dc0651f6f96658b1b139 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
module NativeTypes {
newtype uint64 = int
}
module ConversionModule {
import opened NativeTypes
predicate Uint64ToBytes(u:uint64) { true }
}
abstract module AppStateMachine_s {
import opened NativeTypes
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression20.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 175 | 700246778cd62f359f2fd8cf38a8a1bb5699a84036a5cc66f4be16a98c6004a4 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// The type name "bv" once crashed the resolver
method M(x: bv) // error: undeclared type bv
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 739 | b9c9b22151924d5bf9231cd0a07e05f927e4e2d9a32298d0c09e18a8eee18953 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method Main()
{
var z := OutParametersInLetBodies();
DoSomeFloors();
}
// Here is a regression test
method OutParametersInLetBodies() returns (t: int)
{
t := 25;
var z := var y := 30; F(t, y);
assert z... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression4.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 865 | f0d97894c9109a02552c554009dbb3ec8f1129ce8d9f5da9b29187985a07e395 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
method Main() { }
datatype Maybe<T> = Nothing | Just(T)
function fromJust<T>(x: Maybe<T>): T
requires x.Just?
{
match x case Just(v) => v
}
type mem = int
type AbsPTable = seq<Maybe<AbsL2PTable>>
type A... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression5.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 314 | c135640e163a93f25f21a4e2117cecb9072bc13adfefb09c108e15e9c6e2fb52 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
type Syn = bv8
method P(x: int) returns (y: bv8)
requires x < 256
{
y := x as Syn; // error: value might be negative
}
method Q() {
var r: int := -3;
var v: bv8;
v := r as bv8; // error: value most certainly is negative
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression6.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 655 | 22bcdcaa36dc96fa9fe6378a9f3a311d3c1f5ece9c688067e9c8ef26e4b2e575 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
function Sum(a: array<int>, lo: int, hi: int): int
requires 0 <= lo <= hi <= a.Length
reads a
decreases hi - lo
{
if lo == hi then 0 else a[lo] + Sum(a, lo+1, hi)
}
method Main()
{
var a := new int[100];
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression7.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 824 | faf0f90a05e571aea9b76ce49f4a77e28a682cb0c6236df62c05d70bcb2e98a0 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
module ListLibrary {
datatype List<B> = Nil | Cons(head: B, tail: List<B>)
}
module Q {
import LL = ListLibrary
datatype Queue<T> = FQ(front: LL.List<T>, rear: LL.List<T>)
function MyCons<W>(w: W, ws: LL.L... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression8.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 395 | 0ed7ba9aa6312a624c10bfc624f96aee9eb6d03a9d63f6176d2e343c88f9e74f | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
function F(x: int, w: int): (int, int)
requires x < 100
function G(m: int): int
requires 0 <= m
method Test(y: int, n: nat)
{
// In a previous version of Dafny, the following line had caused two
// error messages of the precondition vio... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Regression9.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 746 | 58b6ab8e91ab433f7613c17d45b77cef85ceac8e3a049c2ff28960aee92520d0 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Some tests for the type inference that was revamped
// to better support subset types.
method Main()
{
var f := F;
var f' := F';
var f'' := F'';
var c := InitArray(F);
var d := InitArray(F');
var e :... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/set-compr.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,144 | ca2ac6cd197b2aea9491bf6882092119c61982d00de4055a688c8476851d6346 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module M0 {
method M()
modifies set o: object | allocated(o) // allowed, since comprehension is in ghost context
{
}
method N()
requires null in set o: object? | allocated(o) // (X) allowed, since comprehension is in ghost contex... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/SoftwareFoundations-Basics.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,691 | 073bffc2a2061d8a7dd58aff289052393ad823ff264b216e013fcde1d366b4e2 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Basics.v done in Dafny
// Enumerated Types
// Days of the Week
datatype day =
monday
| tuesday
| wednesday
| thursday
| friday
| saturday
| sunday
// See method test_next_weekday() below for an explanation of why this... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/UnionFind.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 13,200 | 9a31383cc4fcdaae5bb00d797e97743915b0d96d24bf7c7c58a23e44d3a31948 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Rustan Leino, Nov 2015
// Module M0 gives the high-level specification of the UnionFind data structure
abstract module M0 {
class Element { }
class {:autocontracts} UnionFind {
ghost var M: map<Element, Elem... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/DafnyTests/zeroExitCodeTests.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 94 | 3cfdf9c0c50971322bb07dee1a7dc4f3f4b75985000114790d422d0bfb6caadd | // RUN: %baredafny test %args "%s" >> "%t"
method {:test} Passing1() {
expect 2 == 2;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/allowWarningsDoo.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 230 | b7c2f74ae25bf134998f691bdb8337e1a62a5ce69e6345be0e20df1a0ed0f953 | // RUN: %build %s -t:lib --allow-warnings --output="%S/Output/allowWarnings.doo" &> "%t"
// RUN: ! %stdin "method Bar() { }" %resolve --stdin %S/Output/allowWarnings.doo &>> %t
// RUN: %diff "%s.expect" "%t"
method Foo() {
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/semanticOptions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 415 | be0855f2f2597aca541781956a18b26afed5e2ec6adb814b5e13c4b1859c286f | // RUN: %build -t:lib %s --function-syntax:3 --output=%t3.doo &> %t
// RUN: %build -t:lib %s --function-syntax:4 --output=%t4.doo &>> %t
// RUN: %resolve %t3.doo --function-syntax:3 &>> %t
// RUN: %resolve %t4.doo --function-syntax:3 &>> %t
// RUN: %resolve %t3.doo --function-syntax:4 &>> %t
// RUN: %resolve %t4.... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/standardLibraryOptionMismatch.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 162 | 8eb4cf34caae54498e98cc5f5e8761970982ae0368fab53df7615df70cd95db7 | // RUN: %translate cs %trargs --allow-deprecation --unicode-char false --standard-libraries true %s &> "%t"
// RUN: %diff "%s.expect" "%t"
method Foo() {
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 184 | af26f265204868d7526ce9886a0b1b78b07e6ea095d503976b9c0b00aab33cc7 | // RUN: %exits-with 1 %baredafny resolve --use-basename-for-filename "%s" "%S/NoSuch.doo" > "%t"
// RUN: %diff "%s.expect" "%t"
// Input .doo file does not exist
const c := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 189 | e9b112cb4d965760cf35990d16d7587f78fd4b2891c6a1b8418f4dee77d495d0 | // RUN: %exits-with 1 %baredafny resolve --use-basename-for-filename "%s" "%S/BadDoo.doo" > "%t"
// RUN: %diff "%s.expect" "%t"
// Input .doo file has invalid content
const c := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 301 | 46b179e36c645df41bae4c5c061cab91671d6113fd41374b12610f1441a6885f | // RUN: %baredafny build -t:lib --use-basename-for-filename "%s" --output "%S/test" > "%t"
// RUN: %baredafny resolve --use-basename-for-filename "%S/Test3a.dfy" "%S/test.doo" >> "%t"
// RUN: %diff "%s.expect" "%t"
// Output file does not have a .doo suffix; test.doo created
const c := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test3a.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 88 | def8393cbd8a3ea5af66b995a822e363802731c326923c9594c1bc4fd56e9d3a | // RUN: %baredafny --help
// Just an auxiliary file to Test3.dfy
const d := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test4.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 213 | 4f012d2b721bfb8ed70b39d15bc2f553f6ab00ca5441022f1953fbd2678ee223 | // RUN: %build -t:lib "%s" --output "%S/test2" > "%t"
// RUN: ! %resolve "%s" "%S/test2.doo" >> "%t"
// RUN: %diff "%s.expect" "%t"
// Combining a file with a .doo of itself -- was a crash
const c := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/Test5.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 169 | c90bd0c09a0c063640868f9de2836c900b5f4f8af13e2e9ec4d0cd5edafa909a | // RUN: %exits-with 1 %baredafny build -t:lib --use-basename-for-filename "%s" --output: 2> "%t"
// RUN: %diff "%s.expect" "%t"
// Missing output
const c := 42
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/useGeneratesUnderscoreVariables.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 381 | 56f79d9702b72b5f2701a45338cbcf0204f13415c74e5e3541de54f7cc9f9501 | // RUN: %build -t:lib "%S/Inputs/generatesUnderscoreVariables.dfy" --output "%S/Build/function" > "%t"
// RUN: %resolve "%s" "%S/Build/function.doo" >> "%t"
// RUN: %diff "%s.expect" "%t"
lemma TestInjective() {
assert Injective<int, int>((x) => x + 2);
var square := (x: int) => x * x;
assert square(-1) =... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/doofiles/useReadsOnMethodsLibrary.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 334 | 84c21d9d59fb4bca5f8bccd2fcc00a89a0626120079a0240964b8e09a8f8895c | // RUN: %build -t:lib --reads-clauses-on-methods "%S/Inputs/readsOnMethodsLibrary.dfy" --output "%S/Output/readsOnMethodsLibrary.doo" > "%t"
// RUN: %resolve %s --library "%S/Output/readsOnMethodsLibrary.doo" >> "%t"
// RUN: %diff "%s.expect" "%t"
module Client {
import Library
method Bar() {
Library.... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/examples/maximum.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 971 | 3bed815f5c97c164f1d187600d35bcc716e1354233175f0be1fdbd9e350f4a8a | // RUN: %testDafnyForEachResolver "%s"
// This file shows how to specify and implement a function to compute the
// largest element of a list. The function is fully specified by two
// preconditions, as proved by the MaximumIsUnique lemma below.
method Maximum(values: seq<int>) returns (max: int)
requires ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/examples/parser_combinators.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 13,453 | 1cd9a1ef05b2d11d2f37793e73c039a0a29da359c8af723fc325e0dc60c3012d | /// # Parser combinators in Dafny
///
/// *Clément Pit-Claudel*, 2022-09-27
///
/// Challenge: define parse combinators. As a usability test, use them to parse
/// expressions of the form `(ⁿ)ⁿ` (`n` opening parentheses followed by `n`
/// closing parentheses).
///
/// For a refresher on parser combinators, yo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/examples/parser_combinators_error.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 191 | 5e58b4405635d0aed55cb675a1a69645d2f8e15893fafd66ce29bb2ea46648ad | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function Apply(f: () -> int): int { f() }
function F0(): int { Apply(F0) } // error: cannot use F0 naked here
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/Exceptions1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,541 | 58ca69fb4dc1201b54c3b19e8fea1d63c27cb3a7c909643ea11e6b2fe678250c | // RUN: %testDafnyForEachCompiler "%s" -- --relax-definite-assignment
include "./NatOutcome.dfy"
include "./VoidOutcome.dfy"
method Switch(b: bool, v: nat) returns (res: NatOutcome) {
if b {
res := MakeNatSuccess(v);
} else {
res := MakeNatFailure("bad luck");
}
}
method TestCo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/Exceptions1Expressions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,885 | d7a404b36a6d39710dba5823c7efed8233551136061733eee298f972feba1153 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
include "./NatOutcomeDt.dfy"
include "./VoidOutcomeDt.dfy"
function Switch(b: bool, v: nat): NatOutcome {
if b then NatSuccess(v) else NatFailure("bad luck")
}
function TestControlFlowCase_Nat(switch1: bool, switch... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/GenericOutcomeDt.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 442 | 42f36f07b0fcade94aa7bc77b6d2a092caabfdc19485cff0f61c389a175f711c | // RUN: %testDafnyForEachResolver "%s"
// Does not test anything Exceptions-related, but is included by other tests
datatype Outcome<T> =
| Success(value: T)
| Failure(error: string)
{
predicate IsFailure() {
this.Failure?
}
function PropagateFailure<U>(): Outcome<U> requires IsFailure(... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/NatOutcome.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,388 | 928e4cfe04b73e986d8182d6bc037e340e088cb4ae9e5773e805f540e779c696 | // RUN: %testDafnyForEachResolver "%s"
// Does not test anything Exceptions-related, but is included by other tests
datatype Option<T> = None | Some(get: T)
function Unreachable<R>(): R
requires false
{
var o: Option<R> := None;
assert o.Some?;
o.get
}
trait NatOutcome {
predicate... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/NatOutcomeDt.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 437 | 2bdee7a97ba2eecb66a8056c602cde62cea067eb3397a89f29fded55f5f697fe | // RUN: %testDafnyForEachResolver "%s"
// Does not test anything Exceptions-related, but is included by other tests
datatype NatOutcome =
| NatSuccess(value: nat)
| NatFailure(error: string)
{
predicate IsFailure() {
this.NatFailure?
}
function PropagateFailure(): NatOutcome requires Is... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/ParseErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 698 | 79eaad68bd52e76ecb76fe28478bc2043ecdcfbcac876ff160ad126b22c59930 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
include "./NatOutcome.dfy"
include "./VoidOutcome.dfy"
method MultiAssignment(r1: NatOutcome, r2: NatOutcome) returns (res: NatOutcome) {
var a0, b0 := r1, r2; // <-- multi-assignment allowed
var a1, b1 :- r1, r2; // <-- multi-assignment allow... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/TestAttributeErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 427 | 725cd99c9dd42020a69232557c830bfe48e6e32aa6c327955ec3c42075e2a2dc | // RUN: %exits-with 3 %build "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
include "../exceptions/VoidOutcomeDt.dfy"
ghost function {:test} PassingTest(): VoidOutcome { // compile error: function must be compiled to use the {:test} attribute
VoidSuccess
}
ghost function {:test} FailingTest(): VoidOutcome {... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/TypecheckErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,032 | 2392ead5a537cc70bcbb6a0b91e45ac97f04f33b97f7e2bea2cd1161827122a2 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
include "./NatOutcome.dfy"
include "./VoidOutcome.dfy"
method TestTypecheckingInDesugaredTerm_Nat() returns (res: NatOutcome) {
var a0 := MakeNatSuccess("not a nat");
var a :- MakeNatSuccess("not a nat either");
return a0;
}
method R... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/VerificationErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 549 | d01c12c1e80445fa47ffe757e82f105725ad59a59cc147e12613975e9d858d0c | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
include "./NatOutcome.dfy"
include "./VoidOutcome.dfy"
method CheckThatVerifierRunsInsideDesugaredExprs_Nat(r1: NatOutcome, r2: NatOutcome) returns (res: NatOutcome) {
var a :- MakeNatSuccess(assert r1 == r2; 12);
res := MakeNatSuccess(a);
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/VoidOutcome.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 927 | 68da94746c765b52c5b2535197d7889160ca7c657213ab33ab6e41c33ec2dfd7 | // RUN: %testDafnyForEachResolver "%s"
// Does not test anything Exceptions-related, but is included by other tests
trait VoidOutcome {
predicate IsFailure()
function PropagateFailure(): VoidOutcome requires IsFailure()
}
class VoidSuccess extends VoidOutcome {
constructor() {}
predicate I... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/exceptions/VoidOutcomeDt.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 350 | 92ded0f92c602cd2c1c9eea2275f5d0a40c4c554598238824345071d49fc664e | // RUN: %testDafnyForEachResolver "%s"
// Does not test anything Exceptions-related, but is included by other tests
datatype VoidOutcome =
| VoidSuccess
| VoidFailure(error: string)
{
predicate IsFailure() {
this.VoidFailure?
}
function PropagateFailure(): VoidOutcome requires IsFailure... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/expectations/Expect.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 662 | 115354ada750683b81f34cefecea78bc0fece3be4313a548e4f6d098ba5ac3cc | // RUN: ! %baredafny run %args --target=cs "%s" > "%t"
// RUN: ! %baredafny run %args --target=go "%s" >> "%t"
// RUN: ! %baredafny run %args --target=java "%s" >> "%t"
// RUN: ! %baredafny run %args --target=js "%s" >> "%t"
// RUN: ! %baredafny run %args --target=py "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/expectations/ExpectAndExceptions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 802 | 08895d8eda01bd475fb4d2bf186fe5735490af436b204b89bcff0d48add61043 | // RUN: ! %run --target cs "%s" > "%t"
// RUN: ! %run --target go "%s" >> "%t"
// RUN: ! %run --target java "%s" >> "%t"
// RUN: ! %run --target js "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
include "../exceptions/NatOutcomeDt.dfy"
include "../exceptions/GenericOutcomeDt.dfy"
method TestAssignOrHalt() {
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/expectations/ExpectWithMessage.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 267 | 2503a5ef69c2b7d68d04a1e6264541b4a5b69f7d70caa392fb30692fa0052376 | // RUN: ! %run --target cs "%s" > "%t"
// RUN: ! %run --target go "%s" >> "%t"
// RUN: ! %run --target java "%s" >> "%t"
// RUN: ! %run --target js "%s" >> "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
expect 2 + 2 == 5, "Down with Doublethink!";
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/expectations/ExpectWithNonStringMessage.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 460 | f5dacffe563a14ca9a0c2d14d12b4d92a0cf7fcf9cd4827fcd1c086f2a790894 | // RUN: %verify "%s" > "%t"
// RUN: ! %run --no-verify --target cs "%s" >> "%t"
// RUN: ! %run --no-verify --target go "%s" >> "%t"
// RUN: ! %run --no-verify --target java "%s" >> "%t"
// RUN: ! %run --no-verify --target js "%s" >> "%t"
// RUN: ! %run --no-verify --target py "%s" >> "%t"
// RUN: %diff "%s.expect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.