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/dafny0/BitvectorResolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,602 | 1cd01d7386e5ae19f4644174dbfb28f4119f64997e39f9890627555100918bbd | // RUN: %exits-with 2 %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module LiteralSizes {
method M(a: bv1, b: bv32) returns (c: bv32, d: bv1)
{
c := b;
d := a;
var x := 5000; // error: number too big
d := x;
var y := 4000;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Bitvectors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,081 | 0e762699d68245352090cc214f349db9897d35daf25948d09eb09b0204dbbb7a | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
// Note the difference in Java output is due to
// https://github.com/dafny-lang/dafny/issues/4152
method M(a: bv1, b: bv32) returns (c: bv32, d: bv1)
{
c := b;
d := a;
var x := 5000;
c := x;
var y := 4000... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/BitvectorsMore.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,468 | 1f8c38666bbf0d4b5df994a2e88d33e0e6c75acaecb0349555346d697ebeff64 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --error-limit=0 --relax-definite-assignment --rprint:-
method M() {
var h: bv8 := 5;
var k := h * 128 / 128;
assert k == 1;
h := 3;
k := h * 128 / 128;
assert k == 1;
h := *;
k := k / h; // error: division by zero
}
metho... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/BoundedPolymorphismCompilation.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,998 | bdb6a171bd5d945e4ad3e0fd31d5579d9e78a0b70f7747f38a95a6ae8649a9d8 | // RUN: %testDafnyForEachCompiler "%s" -- --type-system-refresh=true --general-traits=datatype
method Main() {
As.Test();
Is.Test();
Basic.Test();
Bounds.Test();
BoundsAndCasts.Test();
Conversions.Test();
Operators.Test();
ReturnExpr.Test();
}
module As {
trait Parent {
const k: i... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/BoundedPolymorphismResolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 15,341 | f09195fa1fa5724e7e6a5e6d1a85f273079eeba3a5341de7be44da89a428936f | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s" -- --general-traits=datatype
module BadTypeNames {
datatype DT<W extends Unknown> = Dt(w: W) // error: what is Unknown?
type Syn<X extends Unknown> = DT<X> // error: what is Unknown?
class Class<Y extends Unknown> { // error: what is Unknown?
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/BoundedPolymorphismVerification.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,464 | 62255145aa0c25a23a360151a855621ab438298dbba410fa5e741de029acd338 | // RUN: %exits-with 4 %verify --type-system-refresh=true --general-traits=datatype "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module As {
trait Parent { }
trait Trait extends Parent { }
trait TheOther extends Parent { }
method M<X extends Trait>(x: X) {
var a0 := x as X;
var a1 := x as Trait... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ByMethod.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,043 | ac061cbfaa50b5726e070d4938385ad47abe269305438c4e465ca2dd8e2e6bff | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module ByMethodVerification {
function F(x: nat): int {
x
} by method {
var j := 0;
for i := 0 to x
invariant i == -j
{
j := j - 1;
}
return -j;
}
function G(x: nat): (r: int) {
x
} by meth... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ByMethodResolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,447 | a149f95872175e92ca9dd47d8386417a95c3a3b60945dde2b410a4ba546ffce1 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module Resolution {
function F(x: nat): int {
x
} by method {
var j := 0;
for i := 0 to x
invariant i == -j
{
j := j - 1;
}
if * {
return;
} else {
return -j, 3; // error: wr... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Calculations.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,549 | 9c00d40ac7156c3a643b72e33a283ddf31228da5bda46274dd3bbc46e949b87e | // RUN: %exits-with 4 %verify --allow-axioms --print "%t.dprint.dfy" "%s" > "%t"
// RUN: %resolve --allow-axioms "%t.dprint.dfy" >> "%t"
// RUN: %diff "%s.expect" "%t"
method CalcTest0(s: seq<int>) {
calc {
s[0]; // error: ill-formed line
}
calc {
2;
{ assert s[0] == 1; } // error: ill-fo... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CallStmtTests.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 443 | 02aa35f79c89800df026144090b10c20bcb92ce184b3caf60d41e55144b0d258 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module M0 {
method testing1(t: int)
{
t := m(); // error: should be checked at the Dafny level, not fall to Boogie.
}
method m() returns (r: int)
{
return 3;
}
}
module M1 {
method testing2()
{
var v;
v := ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CanCall.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,175 | 15eb26efd61aa70e14d09174c7ba7448fbf7018178ac2ce73cf8055ec345a45f | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module ModifiesCallee {
ghost function Wrap(S: set<object>): set<object> {
S
}
method DoWrapped(S: set<object>)
modifies Wrap(S)
{
DoOne(S);
}
method DoOne(S: set<object>)
modifies S
{
}
}
module Modifie... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ChainingDisjointTests.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,321 | 62c5448dfab17f81a2a93832faf9bffc7648cda9c78dcaaa197b4106d68289cb | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module TestDisjointSets {
method testing1()
{
var a, b, c := {1,2}, {3, 4}, {5, 6};
assert a !! b !! c;
testing2(a, b, c);
assert !({1,2} !! {2,3});
assert !({1,2} !! {9} !! {2,3}); // tests the accumulation
asser... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Char.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,385 | d4a753f54d320a92d4845dae2f9af34e440ccb4c26d6a7c25929e31a483becd5 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --allow-deprecation
class CharChar {
var c: char;
var d: char;
method Order()
modifies this;
ensures c <= d;
{
if d < c {
c, d := d, c;
}
}
ghost function Recurse(ch: char): bool
reads this;
{
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CharLiteralParseErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 520 | b140be4fe3810f8ff2cf9d6a86087dd7b7012b3ea3a8e9fa6e51b78cdadb7e44 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s" -- --unicode-char=false
// Ensuring that the special support for surrogate pairs in character literals
// doesn't allow character literals with multiple Unicode scalar values
// (which is a real danger given the complexity in allowing ' characters in id... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Coinductive.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,297 | 24253051cfd67bf90b6a81c736a542169ac0ab5ec2fd0c97610face28bd5165e | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s" -- --allow-deprecation
// --------------------------------------------------
module TestInductiveDatatypes
{
// The following types test for cycles that go via instantiated type arguments
datatype Record<T> = Ctor(T)
datatype RecInt = Cto... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CoinductiveProofs.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 8,308 | 07bf82e610520a2a8bf8b1a4431a40f13b6e82d980fcae35e5108fd4f7c2ab9c | // UNSUPPORTED: macosx
// Unsupported because the resource count is slightly different on macosx
// RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --allow-deprecation --performance-stats=1
codatatype Stream<T> = Cons(head: T, tail: Stream)
ghost function Upward(n: int): Stream<int>
{
Cons(n, Upwa... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/columns.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 378 | 18dc52dfa091588b5133e3286f627b3c458dd5bd470c207a33a6c91dc956e885 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Dafny counts columns from 0, but Boogie from one, so for a while there were small bugs with that.
ghost predicate P(x: int)
static method A(x:int) requires x > 0 { // error os 's'
assert (forall y: int :: P(y)); // error on '('
assert x != ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Compilation.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,561 | bbc70f9011a189d42b8aeb924b478cfc9242753368bdfe1c367af66cd4b13bf5 | // RUN: %testDafnyForEachCompiler "%s"
// The tests in this file are designed to run through the compiler. They contain
// program snippets that are tricky to compile or whose compilation once was buggy.
module OnceBuggy {
datatype MyDt<T> = Nil | Cons(T, MyDt<T>)
method M<U>(x: MyDt<int>)
{
m... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Compilation.legacy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,724 | 511cea8d5ce1e6031d83ba16ddc58a07ebf17eff4f483df991d4f9e1e26ed45c | // NONUNIFORM: /autoTriggers:0 not supported by new CLI
// RUN: %dafny /compile:3 /deprecation:0 /autoTriggers:0 /typeSystemRefresh:0 /generalNewtypes:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// The tests in this file are designed to run through the compiler. They contain
// program snippets that are tricky ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CompilationErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,036 | 477f171980b7b6bf5cb5ad579ee566ddf022545afa26822bb064c1409e13cb26 | // RUN: %exits-with 3 %build "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
type MyType
iterator Iter()
ghost method M() ensures false // compile error: body-less ghost method
method P() ensures false // compile error: body-less method
class TestClass {
method Q()
{
if g == 0 {
assume true; //... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Comprehensions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,285 | 51322d26c18c9cecf717efecfde134359b10f944db8fb60b6d5712001bb33557 | // RUN: %exits-with 4 %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method M()
{
var numbers := set i | 0 <= i && i < 100;
var squares := set i | 0 <= i && i < 100 :: Id(i)*i; // verifying properties about set comprehensions with a term expression is... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ComprehensionsNewSyntax.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,235 | 7463ccde39fb6ead1e4037a661a63ff728f46c4b063cd063f84ec2716276869a | // RUN: %exits-with 4 %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method M()
{
var numbers := set i | 0 <= i && i < 100;
var squares := set i | 0 <= i && i < 100 :: Id(i)*i; // verifying properties about set comprehensions with a term expression is... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Computations.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,728 | 763a451b48135a9bbbb3393d644d9ec21864c2d2e3ea8239c5510836adc91202 | // RUN: %verify --allow-deprecation --solver-option="O:smt.qi.eager_threshold=30" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
ghost function fact6(n: nat): nat
{
fact(n+6)
}
ghost function fact(n: nat): nat
{
if (n==0) then 1 else n*fact(n-1)
}
ghost method compute_fact6()
ensures fact(6)==720;
{
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ComputationsLoop.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 211 | 226f4cdfb6f933d1ce5be1a24eac4a94e86b4264c7ccd3aacb44083543c4bf32 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
ghost function KeepDoin'It(x: nat): nat
decreases x
{
KeepDoin'It(x + 1)
}
lemma Test(r: nat)
{
assert KeepDoin'It(20) == r;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ComputationsLoop2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 271 | 88183a09e3be08f35a10a2d12a0f815973ab58c95941589419e1bdcf08bfa644 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
ghost function KeepDoin'It(x: nat): nat
{
KeepDoin'ItToo(x + 1)
}
ghost function KeepDoin'ItToo(x: nat): nat
{
KeepDoin'It(x + 1)
}
lemma Test(r: nat)
{
assert KeepDoin'It(20) == r;
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ComputationsNeg.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,151 | 52786e58efd80c8a57604d549bca2ecd899fd2e50e14d070fcff8410e1feee1e | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
ghost function bad(n: nat): nat
decreases n
{
bad(n+1) // error: termination failure
}
ghost method go_bad()
ensures bad(0)==0
{ // error: postcondition violation
}
datatype Nat = Zero | Succ(tail: Nat)
ghost predicate ThProperty(step:... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ConcurrentAttribute.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,530 | 810bb7f2a65aa382f9a51581e14d8f4f22a9664d5082b51b9f33d920956f9013 | // RUN: %exits-with 4 %baredafny verify --use-basename-for-filename --show-snippets false --reads-clauses-on-methods "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Box<T> {
var x: T
constructor(x: T)
reads {}
{
this.x := x;
}
}
class GhostBox<T> {
ghost var x: T
constructor(x: ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Constant.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,719 | 632ce0eebca1409bd3e655585c5e0a5fcb6620e113a7d7ab85856b59bd697393 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
const one:int := 1
const two:int := one * 2
const three:int := one + two
const Pi:real := 3.14
class Calendar {
static const months:int := 12
static const weeks:int := 52
}
method Main() {
print "one := ", ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ConstantErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,822 | 090495a809334f1365ea37134394dd49555c1e49fba7567cc735c88c2f8f8eb7 | // RUN: %exits-with 2 %verify --allow-axioms --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module A {
const two:int := 2.5 // error: type does not match
}
module A' {
const one:int := 1
const three:int := 3
const four:int := three + one
const fi... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ContainerRanks.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 834 | 2fd3d36b1c9da6eb79d2df3cb25884eacab1d540bea914752d95b30a09fe267a | // RUN: %testDafnyForEachResolver "%s"
datatype Abc = End | Wrapper(seq<Abc>)
lemma SeqRank0(a: Abc)
ensures a != Wrapper([a])
{
assert [a][0] == a; // TODO: one could consider strengthening axioms to eliminate the need for this assert
// The reason we need the assert is to match... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ControlStructures.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,994 | df33e4f0564d799b6488bb59741bb2da6381db328875aba1aeb02635c0f68328 | // RUN: %exits-with 4 %verify --relax-definite-assignment --allow-deprecation "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype D = Green | Blue | Red | Purple
method M0(d: D)
{
match (d) { // error: two missing cases: Blue and Purple
case Green =>
case Red =>
}
}
method M1(d: D)
requi... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CoPrefix.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,285 | a6228529e81b2818971bcee522d071cd7e94f46bee91a0592ffe8a03c4786bc1 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --allow-deprecation
// ----- Stream
codatatype Stream = Nil | Cons(head: int, tail: Stream)
ghost function append(M: Stream, N: Stream): Stream
{
match M
case Nil => N
case Cons(t, M') => Cons(t, append(M', N))
}
ghost function zero... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Corecursion.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,845 | a91711e5432a175081fae4141985973921a4dcceb25c475465b827baf9f85dde | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --type-system-refresh=false --general-newtypes=false
// NOTE: This test fails with the new resolver, because Cons(n, A(...)) in function B is inferred to have type Stream<nat>. This should be fixed.
// --------------------------------------------------
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CoResolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,971 | 607dc713a21f90babb59501f5898ce659bceb3be32bcd3dc114065fbe22bbff9 | // RUN: %exits-with 2 %verify --allow-axioms --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module TestModule {
class TestClass {
greatest predicate P(b: bool)
{
!b && Q(null)
}
greatest predicate Q(a: array<int>)
{
a == nu... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CustomErrorMesage.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,176 | 8d443836a08a92ff054d5c4943998b25f53258575162a792971b31d3331c0c13 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
method m(x:int)
{
assert {:error "m: x must be positive"} x > 0;
}
ghost function f(x:int):int {
assert {:error "f: x must be positive"} x > 0;
x
}
ghost function f1():int {
foo(-1)
}
ghost function foo(x:int) : (y:int)
requi... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DafnyLib.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,355 | 919e9eff2059725c7a0cac24761aef233a341ea6e00fe1499441188ff8d26ac8 | // RUN: echo Compiled elsewhere
// This file is part of the test suite. It is compiled by DafnyLibClient.dfy,
// since the DLL from this file is a dependency of DafnyLibClient.
// Regression test for the way the compiler used to disambiguate modules with the same
// name, but in different locations in the nested ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DafnyLibClient.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,107 | 221d2f148767bc197c19ecf995e54d7c9baebff60cfac065b776ec388c825452 | // This test isn't possible with the new CLI commands, because it wants to compile a Dafny library to a .dll
// and use that as part of another Dafny project. It expects the Dafny source of the library to be included in the .dll
// as a Source attribute. However, 'dafny build' and `dafny run` always include the Dafny... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Datatypes.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,074 | b387e2a88057d455a139eea7daf9a427b829c13724b65b2dd53450ff08f5d044 | // RUN: %exits-with 4 %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
datatype List<T> = Nil | Cons({:custom 3 } T, {:custom 3 } List<T>)
class Node {
var data: int
var next: Node?
ghost function Repr({:custom} list: List<int>): bool
reads *
decreases list
{... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DatatypeUpdate.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,733 | ba8bb27eb51ca24b28b7ee70309e29f46862f90b8d37f812971c80ba73804704 | // RUN: %exits-with 4 %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module NewSyntax {
datatype MyDataType = MyConstructor(myint:int, mybool:bool)
| MyOtherConstructor(otherbool:bool)
| MyNumericConstructor(42... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DatatypeUpdateResolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,367 | 6b2c59cb8819cb53d7fbed93bd2dae7c7f9e35d689a29e23069c6df2445b8255 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module MainStuff {
datatype MyDataType = MyConstructor(myint:int, mybool:bool)
| MyOtherConstructor(otherbool:bool)
| MyNumericConstructor(42:int)
datatype SomeOtherType = S_O_T(non_destructor: int)
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo0.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,028 | ddd15381d08b471b4d95c2ff125dc3b16f78e2ed9f5705fbe6b3f5837f446998 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
method GoodInstances(x: int, y: int) {
assert true decreases to false;
assert 1 decreases to 0;
assert x decreases to x - 1;
assert (x, y decreases to x, y - 1); // the parentheses here make this into a "decreases to" expression
assert y > ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,636 | 0a566501317abbbeed7936028d8249750c38add404dfa974cb24789685eb1385 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --show-proof-obligation-expressions
method GoodInstances(x: int, y: int) {
assert (true decreases to false);
assert (1 decreases to 0);
assert (x decreases to x - 1);
assert (x, y decreases to x, y - 1);
var s := {x, y, x*y};
var s' :=... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 631 | 17706672fbd6473c0179a6c3a76ce204453ace8b373ae81b58f4e7103c9403f1 | // RUN: %exits-with 2 %resolve "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// Parentheses but missing "to"
method BadParse0() {
assert (decreases); // parsing error
}
method BadParse1() {
assert (nonincreases); // parsing error
}
// Arguments and parentheses, but missing "to"
method BadParse2() {... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 857 | 641bb9ade00805c795aa67beb5bbc15fb88608a8b345d1c9c82f47b84616925a | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s" -- --show-proof-obligation-expressions
method M1() {
assert (1 decreases to 0) && (0 decreases to 1); // error: second conjunct doesn't hold
}
method M2() {
assert 0 decreases to 1; // error
}
method PrettyPrinting0(b: bool) {
assert b <=... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo4.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 675 | 2937fc3b8f25afd621c546f085bf54a9096c2409bb56f2371bc519585dcc3a8a | // RUN: %exits-with 2 %resolve "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method AttemptAtBinding0(x: int) {
assert (x := 1 decreases to x - 1); // parsing error
}
method AttemptAtBinding1(x: int) {
assert (0 := x decreases to x - 1); // parsing error
}
method AttemptAtBinding2(x: int) {
assert (00... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DecreasesTo5.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 570 | 55efcfdaac4416c1c5c20201f7ceacd27df549396df15b2271006207475a70e1 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
method NonGhost(x: int) {
expect x - 1 decreases to x; // error: cannot use ghost expression here
}
method GhostVariable(x: int) returns (c: bool) {
ghost var b := x - 1 decreases to x; // b is inferred to be ghost
c := b; // error: cannot as... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DefaultParameters.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 16,798 | b027b55bc1b5fb7564614de3e5dd2de618ef6891e317e8dafec1c841b027572e | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
module Actuals {
datatype List<T> = Nil | Cons(T, tail: List<T> := Nil)
method M(a: int, b: int) returns (r: int)
ensures r == a + 2 * b
{
r := a + 2 * b;
}
function F(a: int, b: int, c: int): int
{
a + 2 * b + 3 * c
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Definedness.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,486 | 5d6d7b6ee6749ff2b08834799de566757b1fd373ee166e313c0a42e1835b9cce | // RUN: %exits-with 4 %verify --relax-definite-assignment --allow-deprecation --allow-axioms "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// ----------------- wellformed specifications ----------------------
class SoWellformed {
var xyz: int
var next: SoWellformed?
ghost function F(x: int): int
{ 5 /... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DefiniteAssignment.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,425 | 1ffe11df6983d629f0f89fa2f97fb442d6a01274700109f9348f96a11d5fd76a | // RUN: %exits-with 4 %verify --relax-definite-assignment "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class MyClass<G(00)> {
const x: G
var y: G
ghost var oxA: G // error (TODO: "ghosts never need to be assigned" applies if G were marked as nonempty)
ghost const oxB: G // error (TODO: "ghosts never nee... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Deprecation.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,358 | d9768fdc099d7821a0b9b8c4f95aa0ea3cc46b58e0e9f96b228293effeccda90 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --allow-warnings --relax-definite-assignment
// This file contains tests for messags about various deprecated features.
// As those features go away completely, so can the corresponding tests.
method Main() {
// Test that we get all the way to co... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DeterministicPick.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,077 | 5cb7e873140b61cee277927059be7ccf239b122ecf980f8e2e592c063ffb7dea | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
abstract module Specification {
function Pick(s: set<int>): int
requires s != {}
ensures Pick(s) in s
}
module Attempt_Arbitrary refines Specification {
function Pick...
{
var x :| x in s; // error: cannot prove this is determ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DiamondImports.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,023 | c3e0f82f0659923ac9afa687ead60a391ed47e20c97ecf65b3dcd524cbb8ed74 | // RUN: %exits-with 4 %verify "%s" --relax-definite-assignment > "%t"
// RUN: %diff "%s.expect" "%t"
module ImportByName {
module A {
type T(0)
function P(): T
method M(t: T)
}
module B {
import A
}
module C {
import A
type K = A.T
import W_A = W_B
import W... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DirtyLoops.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 14,693 | 14f57cbe40a596b0d9a8668ec8bfafdc4a8c99be3be8789fe18778935bce47d0 | // RUN: %exits-with 4 %verify --relax-definite-assignment --print:"%t.dprint.dfy" "%s" > "%t"
// RUN: %resolve "%t.dprint.dfy" --allow-warnings >> "%t"
// RUN: %diff "%s.expect" "%t"
// For a body-less loop specification, a local variable or
// out-parameter "x" is havocked by the loop translation
// if "x" is m... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DiscoverBounds.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,954 | 7ec37b9cb0eac56e13715bb5c455746a672004a811ae9d60fa41d1f29a168753 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --allow-warnings --relax-definite-assignment
newtype NT = x | 0 <= x < 100
newtype UT = NT
newtype Lower = x | -2 <= x
newtype Upper = x: Lower | x < 100
newtype Int = int
newtype NR = r | -2.0 <= r <= 5.4
method Main()
{
var n: NT :| ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DiscoverBoundsErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,010 | f2661c66f20296b71bdf53ed49a08e8889c87c527994ab232ab95797da7e34e3 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
newtype Lower = x | -2 <= x
newtype NR = r | -2.0 <= r <= 5.4
method Main()
{
var b;
b := forall o': Lower :: true ==> P(o' as int); // error: cannot find finite range
b := forall r: real :: 0.0 <= r <= 100.0 ==> Q(r); // error: cannot f... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DisplayExpressions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,561 | 52a5eb8f471370bb949b43c78b2cf63c89be0d22e18ca02a80fc18377528d2b7 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module AA {
method M()
{
var m := map[]; // error: underspecified type
}
method N()
{
var n := multiset{}; // error: underspecified type
}
method O()
{
var o := []; // error: underspecified type
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DividedConstructors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,340 | 377aeef003097e42db22c10b788b775cedbdc4ec0493d3617af49434fc7316f8 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment --allow-deprecation
method Main() {
var m := new M0.MyClass.Init(20);
print m.a, ", ", m.b, ", ", m.c, "\n";
var r0 := new Regression.A.Make0();
var r1 := new Regression.A.Make1();
assert r0.b != r1.b;
print... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DTypes.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,493 | c6ef6e4437769a22a044f9ee11d16715a52b9228ebb8fb6051b91f7f957501d3 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
class C {
var n: set<Node?>
method M(v: Stack)
//requires v != null
{
var n': set<object?> := n;
assert v !in n'; // should be known from the types involved
}
method N(v: Stack?)
/* this time with the possibility of... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/EqualityTypes.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 15,264 | 08e5c610d960bd7a8cee58fada92434898b544cd6f085813a5df3e89870ab4ee | // RUN: %exits-with 2 %verify --allow-deprecation --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module A {
datatype Explicit<T(==)> = Nil | Cons(set<T>, Explicit<T>)
datatype Inferred<T> = Nil | Cons(set<T>, Inferred<T>)
class C {
method M<T>(x: Expl... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/EqualityTypesCompile.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,115 | 553da0a6fd989b8150e063272aae206b2a837a9deceb71fd704c4d39cf05c7c8 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --relax-definite-assignment
datatype List<A> = Nil | Cons(A, List) | ICons(int, List)
datatype TwoLists<A> = Two(List, List)
codatatype Co<A> = Atom(A) | CoCons(int, Co) | CoConsA(A, Co)
method M<A>(xs: List, a: A) returns (r: bool)
{
var u := ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/EqualityTypesModuleExports.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 14,339 | eadeedb93ee96fe2c9d63db023c315768d630660cbd55ca2caf26b92c8844e3d | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This module contains checks that (==) types are inferred and required as they should.
module AAA {
iterator IterA<Xyz>(u: set<Xyz>) // this should infer Xyz to be (==)
iterator IterB<Qpr>()
requires var s: set<Qpr> := {}; |s|... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ErrorsInRelatedModules.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,507 | 39b624b0695d9ab93242541cfa564e7f39dee2b56dd436ed591a9b9dd8e30cb7 | // RUN: %exits-with 2 %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// This file gives some regression tests, where Dafny once had crashed when an imported module
// or nested module was not successfully resolved.
module ImportTests {
module LibraryModule {
datatype Packet = Packet(UndeclaredType) ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ExternNegative.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 620 | da1374587b7862b6ff36fc83e33cf4cff141ccd0eedfa87cc41f1ff84962aa5a | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module {:extern "Modx"} Mod1
{
class {:extern "classx"} Class1
{
static ghost function {:extern "Fun1x"} Fun1() : int
ensures Fun1() > 0
static method {:extern "Method1x"} Method1() returns (x: int)
ensures x > 0
static a... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ExternNegative2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 628 | 7b13b6a065e188f60e86b15333e7e630befd3fdeed18c6caf6e0bd264f4a0b95 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module {:extern "Modx"} Mod1
{
class {:extern "classx"} Class1
{
static ghost function {:axiom} {:extern "Fun1x"} Fun1() : int
ensures Fun1() > 0
static method {:axiom} {:extern "Method1x"} Method1() returns (x: int)
ensures x... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ExtremeReads.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 4,550 | b5f6a58b16766985b6f552a1d038be74b15f97749b11fa5adcd785da1ef48343 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
class C {
var data: int
var next: C?
}
greatest predicate P(c: C?)
requires c != null
reads *
{
c.next != null && P(c.next)
}
greatest predicate Q(c: C?)
requires c != null
reads c
{
c.next != null && Q(c)
}
greatest ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForallCompilation.legacy.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,250 | eb71b779d85b737c5e0276fced8eb81452cce81ec875040506eb1682da0be1e9 | // NONUNIFORM: New CLI doesn't support /autoTriggers:0
// RUN: %dafny /compile:3 /autoTriggers:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method Main() {
var c := new MyClass;
c.arr := new int[10,20];
c.K0(3, 12);
c.K1(3, 12);
c.K2(3, 12);
c.K3(3, 12);
c.K4(12);
c.M();
c.N();
c.P();... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForallCompilationNewSyntax.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,190 | 30b5eecc29bd4cdda086c55558c21414857356f707344e431967dc309d4e89f8 | // RUN: %testDafnyForEachCompiler --refresh-exit-code=0 "%s" -- --quantifier-syntax:4 --relax-definite-assignment --allow-warnings
method Main() {
var c := new MyClass;
c.arr := new int[10,20];
c.K0(3, 12);
c.K1(3, 12);
c.K2(3, 12);
c.K3(3, 12);
c.K4(12);
c.M();
c.N();
c.P();
c.Q();
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForallStmt.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 8,441 | 9f11a0d048422685128b9ef42291b7d2b53f8fc3fb78508934947b7a929a1d04 | // UNSUPPORTED: windows
// RUN: %exits-with 4 %verify --allow-axioms --manual-triggers "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class C {
var data: int
var n: nat
var st: set<object>
lemma CLemma(k: int)
requires k != -23
ensures data < k // magic, isn't it (or bogus, some would say)
}
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForallStmtResolveErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 6,868 | c8e644d9249fffe3206efc7e01ae38f9cbc451200a6034f814f1e46732e42583 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
module Basics {
method M() {
var k := 0;
forall i | 0 <= i < 20 {
k := k + i; // error: not allowed to assign to local k, since k is not declared inside forall block
}
forall i | 0 <= i < 20
ensures true
{
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForbidNondeterminism.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 677 | 51217a149232f3c97a9658162081a27567c1fbd71e0205764e4ff349c71aa7cc | // RUN: ! %verify --enforce-determinism "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class CK {
var x: int
var y: int
constructor Init() {
x := 10;
} // definite-assignment rules allow fields to be left unassigned [error: determinism]
}
method ArrayAllocation(n: nat, p: nat, q: nat)
{
var a :... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForbidNondeterminismResolve.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,707 | 9695720029defbcb0730efcfba771ef3a41e3f0a55824c5bfe722d3c21a49699 | // RUN: ! %resolve --enforce-determinism "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class C { // error: constructor-less class not allowed by determinism rules
var f: real
}
predicate P(z: int) { true }
method M(c: C)
modifies c
decreases *
{
var x := 3; // fine
var y; // this statement by ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForLoops-Resolution.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,380 | 1aa4634cbcb6f71a9473e463ebd1c396aaffe1706a3616fc8ffb4740790b3220 | // RUN: %exits-with 2 %verify --type-system-refresh=false --general-newtypes=false "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module Tests {
method M0() {
for i := 0 to i + 1 { // error: i is not in scope
}
}
method M1() {
for i := i + 1 to 100 { // error: i is not in scope
}
}
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ForLoops.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 8,222 | dc15fb826a6d36b30790361d61851743687f633efb7e3623f86a1937aefd04d8 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
method M0() {
var limit, j := 100, 0;
for i := 0 to limit
invariant i == j
{
limit, j := limit + 1, j + 1;
}
assert j == 100;
}
method M1(lo: int, hi: int)
requires lo <= hi
{
for i := lo to hi {
assert lo <= i < h... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formatting.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 226 | 92d3a402bab4c11133435d39b4d5826b48f924094cd97822aee2d99f8c6418f2 | // RUN: %baredafny format --print "%s" > "%t"
// RUN: %diff "%s" "%t"
include "formattinginclude.dfy"
module A {
class B {
method C(x: Included.X)
requires x.Z?
{
assert true;
}
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formatting1-2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 163 | b0cd061818d6006e5990d2964ef2a329ed9c5a947d20291f8cac1f657d497e24 | // RUN: echo 'lit should ignore this file'
module A {
class B {
method C(x: Included.X)
requires x.Z?
{
assert true;
}
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formatting1-3.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 47 | 614a80e67793b9030e53468e56db3deb7d15316dbce3be7f738c9015fe7751f1 | // RUN: echo 'lit should ignore this file'
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formatting1.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 427 | ea43b80520c9408a7124bf8da6d665736944370a1b69d07a4c8acd0cc87d7c90 | // RUN: %baredafny format --use-basename-for-filename --print --verbose=true "%s" "%S/formatting1-2.dfy" "%S/formatting1-3.dfy" > "%t"
// RUN: %baredafny format --use-basename-for-filename --print --verbose=false "%s" "%S/formatting1-2.dfy" "%S/formatting1-3.dfy" >> "%t"
// RUN: %diff "%s.expect" "%t"
module A {
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formatting2.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 197 | e33bfa677f7812bfa3f8181dfd4241d5642ff830b618b542ac819df5d587d3f7 | // RUN: %exits-with 1 %baredafny format --use-basename-for-filename --print "%S/unexisting.dfy" > "%t.raw"
// RUN: %sed 's#%S##g' "%t.raw" > "%t"
// RUN: %diff "%s.expect" "%t"
module A {
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formattingcheckfails.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 242 | 71e89782f763b403d7c6d2bb000d74c6237c12ccb68fd21e149cba303ed5ef9d | // RUN: %exits-with 5 %baredafny format --use-basename-for-filename --check "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module A {
class B {
method C(x: Included.X)
requires x.Z?
{
assert true;
}
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formattingchecksucceeds.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 198 | b70540fdfcb5310dbe416e4c0255c1f64e54eeff27cca970c98befb3872507d1 | // RUN: %baredafny format --check "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
module A {
class B {
method C(x: Included.X)
requires x.Z?
{
assert true;
}
}
}
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formattinginclude.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 111 | 32c36c6aae02cbc1749062f779989558c01e33022d847de451058c2e608ac9e3 | // RUN: echo 'lit should ignore this file'
module Included {
import W = Dummy.Z.W
datatype X = Z()
} |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/formattingStdin.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 89 | dc3fd587579988aec0022f6a9d9439bfa2b3e6faf169514ab60995c76d1e4e8b | // RUN: %exits-with 1 %baredafny format --stdin 2> "%t"
// RUN: %diff "%s.expect" "%t"
|
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32ApproximatePrefixErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,744 | cc71798fc5e8da56b9ce0011d4897dca36b70e0b93d7acbb3116138ac579107e | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
// ========================================
// Invalid ~ prefix usage
// ========================================
method TestTildeNotAllowedOnReal() {
// ERROR: Using ~ creates an fp64 literal (not fp32), which cannot be assigned to real type
// ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32ClassificationPredicates.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,232 | 8c9272dbef4efd284d1cfe25a7fa03f8b23797582878fac062a12f32a9f5c16f | // RUN: %testDafnyForEachResolver "%s"
// Comprehensive test for fp32 classification predicates
// Tests all IEEE 754 classification predicates as instance members
method BasicClassificationTests() {
var x: fp32 := ~3.14;
var zero: fp32 := 0.0;
var negZero: fp32 := -0.0;
var large: fp32 := ~1.23e10;
... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32ComprehensiveEdgeCases.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 10,962 | 6a86de39df9d79d2d91e31bd9cb138c68a5e825af44fca9e29f1c98a08e8325c | // RUN: %testDafnyForEachResolver "%s"
// Comprehensive edge case tests for fp32
// This tests the handling of denormalized numbers, overflow, underflow,
// and other special cases as specified in the design document.
// Tests behavior of denormalized (subnormal) numbers near the underflow threshold.
// Subnor... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32Equality.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,442 | d4757bb7fe30a65f5651e7bb2be8a530c44c148bea4f6c31ca9e9de612494d03 | // RUN: %testDafnyForEachResolver "%s"
// NONUNIFORM: Only C# for now
// RUN: %run --no-verify "%s" > "%t"
// RUN: %diff "%s.expect_run" "%t"
// Comprehensive test of fp32 equality semantics as specified in the design
// Section 5.3: fp32 has hybrid equality semantics
//
// IMPORTANT: Dafny's == operator is NO... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32EqualityErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,621 | da89fcf0386afc81ce37483e463b49d873605aabc65118105acd24a292694fbc | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// fp32 equality tests - verifies that == works correctly for floating-point
//
// Key rules:
// - In ghost code: == always works (mathematical equality)
// - In compiled code: == requires excluding NaN and different-signed zeros
// - For collections/d... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32Fp64Conversions.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 2,931 | 9e73364550935c7e522a09a4ad6fc6eeb9480d883eeab17a4e62cb17b6cf0d9b | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Tests for conversions between fp32, fp64, real, and int
//
// The 'as' operator requires exact representability (lossless conversion).
// ============================================================================
// POSITIVE TESTS - These should ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32InexactLiteralErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,925 | 7d609996e2e08c492840b55a046e62014df71d85f145e5f586a787d8e46e358e | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
// ========================================
// Inexact literals without ~ prefix
// ========================================
method TestInexactLiteralsRequireTilde() {
// Common inexact decimal values
var bad_d1: fp32 := 0.1; // Error: literal ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32LiteralSyntax.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,281 | c0612ba6d920fc0332dcfb336e96c41e927dc52af50603feb5f6930c31048de7 | // RUN: %testDafnyForEachResolver "%s"
// Tests for fp32 literal syntax, including exact literals, approximate literals with ~ prefix,
// type inference, and practical usage examples
// ===== Core Literal Tests =====
method TestExactFp32Literals() {
// Powers of two are exactly representable
var half: f... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32ResolutionAndLanguage.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 5,522 | 463197134c0ae2d3c4a0e76e29799b6553ec5897e25442e81f14045c7c24141f | // RUN: %testDafnyForEachResolver "%s"
// fp32 language integration and resolution tests
// Tests how fp32 integrates with Dafny's language constructs, type inference, and operations
method TestBasicLiteralAssignment() {
// Basic literal assignment with type inference
var x: fp32 := ~3.14;
var y: fp32 :... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32SpecialValues.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 13,139 | 6b7f43d9a1726d7eff122e32f332fbc0546989307094106e72d36db6e664a43b | // RUN: %testDafnyForEachResolver --expect-exit-code=0 "%s"
// Test for fp32 additional special values
// Tests special constants like PositiveZero, NegativeZero, MaxValue, MinValue, etc.
method TestZeroValues() {
// Test positive and negative zero literals
var pos_zero: fp32 := 0.0;
var neg_zero: fp32 ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp32Wellformedness.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 1,798 | 65c5f27b5f09e16c21e1822435610887be56e21feb8591ced8bf68a05f7bc1a9 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// Test wellformedness checks on fp32 operators
method ArithmeticNaN(x: fp32, y: fp32) {
var _ := x + y; // ERROR x2: requires !x.IsNaN && !y.IsNaN
var _ := x - y; // ERROR x2
var _ := x * y; // ERROR x2
var _ := x / y; // ERROR x3: !x.Is... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64ApproximatePrefixErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,566 | f6591c1e4666fcb8838128d9c23b069f920eb72c06c5f34d48a462ae21bbbd25 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
// ========================================
// Invalid ~ prefix usage
// ========================================
method TestTildeNotAllowedOnReal() {
// ERROR: Using ~ creates an fp64 literal, which cannot be assigned to real type
// The ~ prefi... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64ClassificationPredicates.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,285 | 22e835ed762af4600b13a04b9f4d69a13ea3ab7e903f51da1ce382cdecfe1965 | // RUN: %testDafnyForEachResolver "%s"
// Comprehensive test for fp64 classification predicates
// Tests all IEEE 754 classification predicates as instance members
method BasicClassificationTests() {
var x: fp64 := ~3.14;
var zero: fp64 := 0.0;
var negZero: fp64 := -0.0;
var large: fp64 := ~1.23e100;... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64ComprehensiveEdgeCases.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 11,292 | 3d167c89790db40685cce4c5c75d1e5b5648b0c1cb0b7521d8ed86522d04d2d4 | // RUN: %testDafnyForEachResolver "%s"
// Comprehensive edge case tests for fp64
// This tests the handling of denormalized numbers, overflow, underflow,
// and other special cases as specified in the design document.
// Tests behavior of denormalized (subnormal) numbers near the underflow threshold.
// Subnor... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64Equality.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 12,442 | ac01ec1fa0cda97a58172bf5a31cf2de9b9aea460b93e83004350df211a28a44 | // RUN: %testDafnyForEachResolver "%s"
// NONUNIFORM: Only C# for now
// RUN: %run --no-verify "%s" > "%t"
// RUN: %diff "%s.expect_run" "%t"
// Comprehensive test of fp64 equality semantics as specified in the design
// Section 5.3: fp64 has hybrid equality semantics
//
// IMPORTANT: Dafny's == operator is NO... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64EqualityErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,621 | e436c7de191f6c2ae0af82b68bfcd84fc2cbeae90df9aabc3d9576359f193469 | // RUN: %testDafnyForEachResolver --expect-exit-code=4 "%s"
// fp64 equality tests - verifies that == works correctly for floating-point
//
// Key rules:
// - In ghost code: == always works (mathematical equality)
// - In compiled code: == requires excluding NaN and different-signed zeros
// - For collections/d... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64InexactLiteralErrors.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 3,925 | e6650ceb67b96ddac9bff50a0f6d48bd6bfe7d9da6fb78babcd4c9f22f8a31e6 | // RUN: %testDafnyForEachResolver --expect-exit-code=2 "%s"
// ========================================
// Inexact literals without ~ prefix
// ========================================
method TestInexactLiteralsRequireTilde() {
// Common inexact decimal values
var bad_d1: fp64 := 0.1; // Error: literal ... |
dafny-lang/dafny | Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Fp64LiteralSyntax.dfy | NOASSERTION | 3,473 | master | 368adac6150e6a3825fe2f605dca71353badc779 | 2026-07-21T22:46:38Z | 7,447 | 9eb70b32f5575cd026d21e88906fce78fb5d6678af7a12ba0f2b2b282343ad0f | // RUN: %testDafnyForEachResolver "%s"
// Tests for fp64 literal syntax, including exact literals, approximate literals with ~ prefix,
// type inference, and practical usage examples
// ===== Core Literal Tests =====
method TestExactFp64Literals() {
// Powers of two are exactly representable
var half: f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.