test: Residual de-muting of the test suite. rs=demuting

This commit is contained in:
Patrick Walton 2013-02-25 15:14:33 -08:00
parent 4b9b32839e
commit a08eda4b63
22 changed files with 173 additions and 185 deletions

View File

@ -10,7 +10,7 @@
pub mod kitties {
pub struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
}

View File

@ -10,7 +10,7 @@
pub mod kitties {
pub struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,

View File

@ -10,14 +10,14 @@
pub mod kitties {
pub struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
}
pub impl cat {
fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows }
fn speak(&mut self) { self.meows += 1u; }
fn meow_count(&mut self) -> uint { self.meows }
}
pub fn cat(in_x : uint, in_y : int) -> cat {

View File

@ -10,30 +10,29 @@
pub mod kitties {
pub struct cat {
priv mut meows : uint,
priv meows : uint,
mut how_hungry : int,
how_hungry : int,
name : ~str,
}
pub impl cat {
fn speak() { self.meow(); }
fn speak(&mut self) { self.meow(); }
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
return false;
}
}
else {
error!("Not hungry!");
return false;
}
}
}
pub impl cat {
fn meow() {
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {

View File

@ -10,17 +10,17 @@
pub mod kitties {
pub struct cat<U> {
priv mut info : ~[U],
priv mut meows : uint,
priv info : ~[U],
priv meows : uint,
how_hungry : int,
}
pub impl<U> cat<U> {
fn speak<T>(stuff: ~[T]) {
fn speak<T>(&mut self, stuff: ~[T]) {
self.meows += stuff.len();
}
fn meow_count() -> uint { self.meows }
fn meow_count(&mut self) -> uint { self.meows }
}
pub fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {

View File

@ -12,8 +12,8 @@ use core::to_str::*;
pub mod kitty {
pub struct cat {
priv mut meows : uint,
mut how_hungry : int,
priv meows : uint,
how_hungry : int,
name : ~str,
}
@ -22,7 +22,7 @@ pub mod kitty {
}
priv impl cat {
fn meow() {
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
@ -33,9 +33,9 @@ pub mod kitty {
}
pub impl cat {
fn speak() { self.meow(); }
fn speak(&mut self) { self.meow(); }
fn eat() -> bool {
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;

View File

@ -10,6 +10,6 @@
pub mod animals {
pub trait noisy {
fn speak();
fn speak(&mut self);
}
}

View File

@ -9,21 +9,21 @@
// except according to those terms.
trait noisy {
fn speak();
fn speak(&mut self);
}
struct cat {
priv mut meows : uint,
mut how_hungry : int,
name : ~str,
priv meows: uint,
how_hungry: int,
name: ~str,
}
impl noisy for cat {
fn speak() { self.meow(); }
fn speak(&mut self) { self.meow(); }
}
impl cat {
fn eat() -> bool {
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
@ -37,7 +37,7 @@ impl cat {
}
priv impl cat {
fn meow() {
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
@ -56,6 +56,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
pub fn main() {
let nyan : noisy = cat(0u, 2, ~"nyan") as noisy;
let mut nyan: noisy = cat(0u, 2, ~"nyan") as noisy;
nyan.speak();
}

View File

@ -28,9 +28,9 @@ impl cmp::Eq for cat_type {
// ok: T should be in scope when resolving the trait ref for map
struct cat<T> {
// Yes, you can have negative meows
priv mut meows : int,
priv meows : int,
mut how_hungry : int,
how_hungry : int,
name : T,
}
@ -95,11 +95,10 @@ impl<T> Map<int, T> for cat<T> {
}
fn remove(&mut self, k: &int) -> bool {
match self.find(k) {
Some(_) => {
self.meows -= *k; true
}
None => { false }
if self.find(k).is_some() {
self.meows -= *k; true
} else {
false
}
}
}

View File

@ -14,39 +14,37 @@ extern mod cci_class_trait;
use cci_class_trait::animals::*;
struct cat {
priv mut meows : uint,
priv meows: uint,
mut how_hungry : int,
how_hungry : int,
name : ~str,
}
impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
return false;
}
}
else {
error!("Not hungry!");
return false;
}
}
}
impl noisy for cat {
fn speak() { self.meow(); }
fn speak(&mut self) { self.meow(); }
}
priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
}
}
@ -60,7 +58,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
pub fn main() {
let nyan = cat(0u, 2, ~"nyan");
let mut nyan = cat(0u, 2, ~"nyan");
nyan.eat();
assert(!nyan.eat());
for uint::range(1u, 10u) |_i| { nyan.speak(); };

View File

@ -12,42 +12,41 @@
#[legacy_modes];
trait noisy {
fn speak();
fn speak(&mut self);
}
struct cat {
priv mut meows : uint,
priv meows : uint,
mut how_hungry : int,
name : ~str,
how_hungry : int,
name : ~str,
}
priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
}
}
impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
return false;
}
}
else {
error!("Not hungry!");
return false;
}
}
}
impl noisy for cat {
fn speak() { self.meow(); }
fn speak(&mut self) { self.meow(); }
}
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
@ -59,12 +58,12 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
}
fn make_speak<C:noisy>(c: C) {
fn make_speak<C:noisy>(mut c: C) {
c.speak();
}
pub fn main() {
let nyan = cat(0u, 2, ~"nyan");
let mut nyan = cat(0u, 2, ~"nyan");
nyan.eat();
assert(!nyan.eat());
for uint::range(1u, 10u) |_i| { make_speak(nyan); };

View File

@ -14,10 +14,10 @@ extern mod cci_class_3;
use cci_class_3::kitties::*;
pub fn main() {
let nyan : cat = cat(52u, 99);
let kitty = cat(1000u, 2);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak();
assert(nyan.meow_count() == 53u);
let mut nyan : cat = cat(52u, 99);
let mut kitty = cat(1000u, 2);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak();
assert(nyan.meow_count() == 53u);
}

View File

@ -9,18 +9,17 @@
// except according to those terms.
struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
}
impl cat {
fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows }
fn speak(&mut self) { self.meows += 1u; }
fn meow_count(&mut self) -> uint { self.meows }
}
fn cat(in_x : uint, in_y : int) -> cat {
fn cat(in_x: uint, in_y: int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
@ -28,8 +27,8 @@ fn cat(in_x : uint, in_y : int) -> cat {
}
pub fn main() {
let nyan : cat = cat(52u, 99);
let kitty = cat(1000u, 2);
let mut nyan: cat = cat(52u, 99);
let mut kitty = cat(1000u, 2);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak();

View File

@ -14,8 +14,8 @@ extern mod cci_class_6;
use cci_class_6::kitties::*;
pub fn main() {
let nyan : cat<char> = cat::<char>(52u, 99, ~['p']);
let kitty = cat(1000u, 2, ~[~"tabby"]);
let mut nyan : cat<char> = cat::<char>(52u, 99, ~['p']);
let mut kitty = cat(1000u, 2, ~[~"tabby"]);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak(~[1u,2u,3u]);

View File

@ -9,17 +9,17 @@
// except according to those terms.
struct cat<U> {
priv mut info : ~[U],
priv mut meows : uint,
priv info : ~[U],
priv meows : uint,
how_hungry : int,
how_hungry : int,
}
impl<U> cat<U> {
fn speak<T>(stuff: ~[T]) {
self.meows += stuff.len();
}
fn meow_count() -> uint { self.meows }
fn speak<T>(&mut self, stuff: ~[T]) {
self.meows += stuff.len();
}
fn meow_count(&mut self) -> uint { self.meows }
}
fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
@ -31,8 +31,8 @@ fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
}
pub fn main() {
let nyan : cat<int> = cat::<int>(52u, 99, ~[9]);
let kitty = cat(1000u, 2, ~[~"tabby"]);
let mut nyan : cat<int> = cat::<int>(52u, 99, ~[9]);
let mut kitty = cat(1000u, 2, ~[~"tabby"]);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak(~[1,2,3]);

View File

@ -12,36 +12,35 @@
use core::to_str::*;
struct cat {
priv mut meows : uint,
priv meows : uint,
mut how_hungry : int,
name : ~str,
how_hungry : int,
name : ~str,
}
impl cat {
fn speak(&mut self) { self.meow(); }
fn speak() { self.meow(); }
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
return false;
}
}
else {
error!("Not hungry!");
return false;
}
}
}
priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
}
}
@ -64,6 +63,6 @@ fn print_out<T:ToStr>(thing: T, expected: ~str) {
}
pub fn main() {
let nyan : ToStr = cat(0u, 2, ~"nyan") as ToStr;
let mut nyan : ToStr = cat(0u, 2, ~"nyan") as ToStr;
print_out(nyan, ~"nyan");
}

View File

@ -9,16 +9,14 @@
// except according to those terms.
struct cat<U> {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
how_hungry : int,
}
impl<U> cat<U> {
fn speak() {
self.meows += 1u;
}
fn meow_count() -> uint { self.meows }
fn speak(&mut self) { self.meows += 1u; }
fn meow_count(&mut self) -> uint { self.meows }
}
fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
@ -30,6 +28,6 @@ fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
pub fn main() {
let _nyan : cat<int> = cat::<int>(52u, 99);
// let kitty = cat(1000u, 2);
let mut _nyan : cat<int> = cat::<int>(52u, 99);
// let mut kitty = cat(1000u, 2);
}

View File

@ -14,9 +14,9 @@ extern mod cci_class_4;
use cci_class_4::kitties::*;
pub fn main() {
let nyan = cat(0u, 2, ~"nyan");
nyan.eat();
assert(!nyan.eat());
for uint::range(1u, 10u) |_i| { nyan.speak(); };
assert(nyan.eat());
let mut nyan = cat(0u, 2, ~"nyan");
nyan.eat();
assert(!nyan.eat());
for uint::range(1u, 10u) |_i| { nyan.speak(); };
assert(nyan.eat());
}

View File

@ -9,13 +9,13 @@
// except according to those terms.
struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
how_hungry : int,
}
impl cat {
fn speak() {}
fn speak(&mut self) {}
}
fn cat(in_x : uint, in_y : int) -> cat {
@ -26,8 +26,8 @@ fn cat(in_x : uint, in_y : int) -> cat {
}
pub fn main() {
let nyan : cat = cat(52u, 99);
let kitty = cat(1000u, 2);
let mut nyan : cat = cat(52u, 99);
let mut kitty = cat(1000u, 2);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
nyan.speak();

View File

@ -9,10 +9,9 @@
// except according to those terms.
struct cat {
priv mut meows : uint,
how_hungry : int,
priv meows : uint,
how_hungry : int,
}
fn cat(in_x : uint, in_y : int) -> cat {
@ -23,8 +22,8 @@ fn cat(in_x : uint, in_y : int) -> cat {
}
pub fn main() {
let nyan : cat = cat(52u, 99);
let kitty = cat(1000u, 2);
let mut nyan : cat = cat(52u, 99);
let mut kitty = cat(1000u, 2);
assert(nyan.how_hungry == 99);
assert(kitty.how_hungry == 2);
}

View File

@ -9,36 +9,34 @@
// except according to those terms.
struct cat {
priv mut meows : uint,
priv meows : uint,
mut how_hungry : int,
name : ~str,
how_hungry : int,
name : ~str,
}
impl cat {
fn speak(&mut self) { self.meow(); }
fn speak() { self.meow(); }
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
fn eat(&mut self) -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
} else {
error!("Not hungry!");
return false;
}
}
else {
error!("Not hungry!");
return false;
}
}
}
priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
fn meow(&mut self) {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.how_hungry += 1;
}
}
}
@ -51,7 +49,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
}
pub fn main() {
let nyan = cat(0u, 2, ~"nyan");
let mut nyan = cat(0u, 2, ~"nyan");
nyan.eat();
assert(!nyan.eat());
for uint::range(1u, 10u) |_i| { nyan.speak(); };

View File

@ -9,13 +9,13 @@
// except according to those terms.
struct cat {
priv mut meows : uint,
priv meows : uint,
how_hungry : int,
how_hungry : int,
}
impl cat {
fn meow_count() -> uint { self.meows }
fn meow_count(&mut self) -> uint { self.meows }
}
fn cat(in_x : uint, in_y : int) -> cat {
@ -26,6 +26,6 @@ fn cat(in_x : uint, in_y : int) -> cat {
}
pub fn main() {
let nyan : cat = cat(52u, 99);
assert (nyan.meow_count() == 52u);
let mut nyan : cat = cat(52u, 99);
assert (nyan.meow_count() == 52u);
}