<commit_before>extern crate vk_generator;
extern crate vk_api;

use std::path::Path;
use std::fs::{File, DirBuilder};
use std::env;
use std::process::Command;
use std::io::Write;
use std::str;

use vk_generator::VkVersion;

#[test]
fn default_global() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("default_global.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML).gen_global(&mut file,
                                                             VkVersion(1, 0), 
                                                             &["VK_KHR_surface"],
                                                             Default::default());
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("default_global.rs").output().unwrap().stderr).unwrap());
}

#[test]
fn default_struct() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("default_struct.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML).gen_struct(&mut file,
                                                             VkVersion(1, 0), 
                                                             &["VK_KHR_surface"],
                                                             Default::default());
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("default_struct.rs").output().unwrap().stderr).unwrap());
}<commit_msg>Upgraded test suite to test all non-default options but use_libc_types<commit_after>extern crate vk_generator;
extern crate vk_api;

use std::path::Path;
use std::fs::{File, DirBuilder};
use std::env;
use std::process::Command;
use std::io::Write;
use std::str;

use vk_generator::{VkVersion, GenConfig};

#[test]
fn default_global() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("default_global.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML)
        .gen_global(&mut file,
                    VkVersion(1, 0), 
                    &["VK_KHR_surface", "VK_EXT_debug_report"],
                    Default::default());
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("default_global.rs").output().unwrap().stderr).unwrap());
}

#[test]
fn default_struct() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("default_struct.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML)
        .gen_struct(&mut file,
                    VkVersion(1, 0), 
                    &["VK_KHR_surface", "VK_EXT_debug_report"],
                    Default::default());
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("default_struct.rs").output().unwrap().stderr).unwrap());
}

#[test]
fn nondefault_global() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("nondefault_global.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML)
        .gen_global(&mut file,
                    VkVersion(1, 0), 
                    &["VK_KHR_surface", "VK_EXT_debug_report"],
                    GenConfig::new()
                        .remove_type_prefix(true)
                        .remove_vk_result_prefix(false)
                        .remove_command_prefix(false)
                        .remove_variant_padding(false)
                        .remove_bitmask_prefix(false)
                        .snake_case_commands(false)
                        .camel_case_variants(false)
                        .snake_case_members(false)
                        .wrap_bitmasks(false));
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("nondefault_global.rs").output().unwrap().stderr).unwrap());
}

#[test]
fn nondefault_struct() {
    let out = env::var("OUT_DIR").unwrap();
    DirBuilder::new().recursive(true).create(&out).unwrap();

    let mut file = File::create(&Path::new(&out).join("nondefault_struct.rs")).unwrap();
    writeln!(file, "fn main() {{}} mod vk {{").unwrap();
    vk_generator::VkRegistry::new(vk_api::VK_XML)
        .gen_struct(&mut file,
                    VkVersion(1, 0), 
                    &["VK_KHR_surface", "VK_EXT_debug_report"],
                    GenConfig::new()
                        .remove_type_prefix(true)
                        .remove_vk_result_prefix(false)
                        .remove_command_prefix(false)
                        .remove_variant_padding(false)
                        .remove_bitmask_prefix(false)
                        .snake_case_commands(false)
                        .camel_case_variants(false)
                        .snake_case_members(false)
                        .wrap_bitmasks(false));
    writeln!(file, "}}").unwrap();

    assert_eq!("", str::from_utf8(&Command::new("rustc").current_dir(&out).arg("nondefault_struct.rs").output().unwrap().stderr).unwrap());
}
{'fraction_non_alphanumeric': 0.18162839248434237, 'fraction_numerical': 0.003131524008350731, 'mean_word_length': 2.4716183574879227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '326869', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1737, 'n_words': 240}