<commit_before>use core::cell::*;
use core::default::Default;
use std::mem::drop;

#[test]
fn smoketest_cell() {
    let x = Cell::new(10);
    assert_eq!(x, Cell::new(10));
    assert_eq!(x.get(), 10);
    x.set(20);
    assert_eq!(x, Cell::new(20));
    assert_eq!(x.get(), 20);

    let y = Cell::new((30, 40));
    assert_eq!(y, Cell::new((30, 40)));
    assert_eq!(y.get(), (30, 40));
}
<commit_msg>Add a few tests for `UnsafeCell`<commit_after>use core::cell::*;
use core::default::Default;
use std::mem::drop;

#[test]
fn smoketest_unsafe_cell() {
    let mut x = UnsafeCell::new(10);
    let ref_mut = &mut x;
    unsafe {
        // The asserts are repeated in order to ensure that `get()`
        // is non-mutating.
        assert_eq!(*ref_mut.get(), 10);
        assert_eq!(*ref_mut.get(), 10);
        *ref_mut.get_mut() += 5;
        assert_eq!(*ref_mut.get(), 15);
        assert_eq!(*ref_mut.get(), 15);
        assert_eq!(x.into_inner(), 15);
    }
}

#[test]
fn unsafe_cell_raw_get() {
    let x = UnsafeCell::new(10);
    let ptr = &x as *const UnsafeCell<i32>;
    unsafe {
        // The asserts are repeated in order to ensure that `raw_get()`
        // is non-mutating.
        assert_eq!(*UnsafeCell::raw_get(ptr), 10);
        assert_eq!(*UnsafeCell::raw_get(ptr), 10);
        *UnsafeCell::raw_get(ptr) += 5;
        assert_eq!(*UnsafeCell::raw_get(ptr), 15);
        assert_eq!(*UnsafeCell::raw_get(ptr), 15);
        assert_eq!(x.into_inner(), 15);
    }
}

#[test]
fn smoketest_cell() {
    let x = Cell::new(10);
    assert_eq!(x, Cell::new(10));
    assert_eq!(x.get(), 10);
    x.set(20);
    assert_eq!(x, Cell::new(20));
    assert_eq!(x.get(), 20);

    let y = Cell::new((30, 40));
    assert_eq!(y, Cell::new((30, 40)));
    assert_eq!(y.get(), (30, 40));
}

{'fraction_non_alphanumeric': 0.2071269487750557, 'fraction_numerical': 0.042316258351893093, 'mean_word_length': 3.1597222222222223, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3681237', 'n_tokens_mistral': 752, 'n_tokens_neox': 689, 'n_words': 140}