<?php
namespace nur;

use nur\t\TestCase;

class baseTest extends TestCase {
  function testZ() {
    self::assertFalse(base::z("0"));
    self::assertFalse(base::z(""));
    self::assertFalse(base::z(0));
    self::assertTrue(base::z(false));
    self::assertTrue(base::z(null));
  }

  function testNz() {
    self::assertTrue(base::nz("0"));
    self::assertTrue(base::nz(""));
    self::assertTrue(base::nz(0));
    self::assertFalse(base::nz(false));
    self::assertFalse(base::nz(null));
  }

  function testT() {
    self::assertTrue(base::t("0"));
    self::assertFalse(base::t(""));
    self::assertFalse(base::t(0));
    self::assertFalse(base::t(false));
    self::assertFalse(base::t(null));
  }

  function testF() {
    self::assertFalse(base::f("0"));
    self::assertTrue(base::f(""));
    self::assertTrue(base::f(0));
    self::assertTrue(base::f(false));
    self::assertTrue(base::f(null));
  }

  function testVf() {
    self::assertEquals("0", base::vf("0"));
    self::assertFalse(base::vf(""));
    self::assertFalse(base::vf(0));
    self::assertFalse(base::vf(false));
    self::assertFalse(base::vf(null));
    self::assertEquals(true, base::vf(true));
    self::assertEquals("a", base::vf("a"));
  }

  function testVn() {
    self::assertEquals("0", base::vn("0"));
    self::assertNull(base::vn(""));
    self::assertNull(base::vn(0));
    self::assertNull(base::vn(false));
    self::assertNull(base::vn(null));
    self::assertEquals(true, base::vn(true));
    self::assertEquals("a", base::vn("a"));
  }

  function testFirstv() {
    self::assertNull(base::firstv());
    self::assertEquals("0", base::firstv("0", 1));
    self::assertEquals(1, base::firstv("", 1));
    self::assertEquals(1, base::firstv(0, 1));
    self::assertEquals(1, base::firstv(false, 1));
    self::assertEquals(1, base::firstv(null, 1));
    self::assertEquals("0", base::firstv("0", "", 0, false, null, 1, 2));
    self::assertNull(base::firstv("", 0, false, null));
    self::assertEquals(1, base::firstv("", 0, false, null, 1, 2));
    self::assertTrue(base::firstv(true, 1));
    self::assertEquals("a", base::firstv("a", 1));
  }

  function testT2() {
    self::assertFalse(base::t2("0"));
    self::assertFalse(base::t2(""));
    self::assertFalse(base::t2(0));
    self::assertFalse(base::t2(false));
    self::assertFalse(base::t2(null));
  }

  function testF2() {
    self::assertTrue(base::f2("0"));
    self::assertTrue(base::f2(""));
    self::assertTrue(base::f2(0));
    self::assertTrue(base::f2(false));
    self::assertTrue(base::f2(null));
  }

  function testVf2() {
    self::assertFalse(base::vf2("0"));
    self::assertFalse(base::vf2(""));
    self::assertFalse(base::vf2(0));
    self::assertFalse(base::vf2(false));
    self::assertFalse(base::vf2(null));
    self::assertEquals(true, base::vf2(true));
    self::assertEquals("a", base::vf2("a"));
  }

  function testVn2() {
    self::assertNull(base::vn2("0"));
    self::assertNull(base::vn2(""));
    self::assertNull(base::vn2(0));
    self::assertNull(base::vn2(false));
    self::assertNull(base::vn2(null));
    self::assertEquals(true, base::vn2(true));
    self::assertEquals("a", base::vn2("a"));
  }

  function testFirstv2() {
    self::assertNull(base::firstv2());
    self::assertEquals(1, base::firstv2("0", 1, 2));
    self::assertEquals(1, base::firstv2("", 1, 2));
    self::assertEquals(1, base::firstv2(0, 1, 2));
    self::assertEquals(1, base::firstv2(false, 1, 2));
    self::assertEquals(1, base::firstv2(null, 1, 2));
    self::assertNull(base::firstv2("0", "", 0, false, null));
    self::assertEquals(1, base::firstv2("0", "", 0, false, null, 1, 2));
    self::assertTrue(base::firstv2(true, 1, 2));
    self::assertEquals("a", base::firstv2("a", 1, 2));
  }
}