当前位置: 首页>>代码示例>>C++>>正文


C++ VS函数代码示例

本文整理汇总了C++中VS函数的典型用法代码示例。如果您正苦于以下问题:C++ VS函数的具体用法?C++ VS怎么用?C++ VS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VS函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VS

bool TestExtVariable::test_floatval() {
  VS(f_floatval("12.3"), 12.3);
  return Count(true);
}
开发者ID:mariusz-szydzik,项目名称:hiphop-php,代码行数:4,代码来源:test_ext_variable.cpp

示例2: VS

bool TestExtProcess::test_pcntl_getpriority() {
    VS(f_pcntl_getpriority(), 0);
    return Count(true);
}
开发者ID:CyaLiven,项目名称:hiphop-php,代码行数:4,代码来源:test_ext_process.cpp

示例3: VS

bool TestExtNetwork::test_gethostbynamel() {
  VS(f_gethostbynamel("localhost"), CREATE_VECTOR1("127.0.0.1"));
  return Count(true);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:4,代码来源:test_ext_network.cpp

示例4: CREATE_MAP1

bool TestExtJson::test_json_decode() {
  Array arr = CREATE_MAP1("fbid", 101501853510151001LL);
  VS(f_json_decode(f_json_encode(arr), true), arr);

  VS(f_json_decode("{\"0\":{\"00\":0}}", true),
     CREATE_MAP1("0", CREATE_MAP1("00", 0)));

  VS(f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}", true),
     CREATE_MAP3("a", 1, "b", 2.3, 3, "test"));
  VS(f_json_decode("[\"a\",1,true,false,null]", true),
     CREATE_VECTOR5("a", 1, true, false, uninit_null()));

  Object obj = f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}");
  Object obj2(SystemLib::AllocStdClassObject());
  obj2->o_set("a", 1);
  obj2->o_set("b", 2.3);
  obj2->o_set("3", "test");
  VS(obj.toArray(), obj2.toArray());

  obj = f_json_decode("[\"a\",1,true,false,null]");
  VS(obj.toArray(), CREATE_VECTOR5("a", 1, true, false, uninit_null()));

  VS(f_json_decode("{z:1}",     true),       uninit_null());
  VS(f_json_decode("{z:1}",     true, k_JSON_FB_LOOSE), CREATE_MAP1("z", 1));
  VS(f_json_decode("{z:\"z\"}", true),       uninit_null());
  VS(f_json_decode("{z:\"z\"}", true, k_JSON_FB_LOOSE), CREATE_MAP1("z", "z"));
  VS(f_json_decode("{'x':1}",   true),       uninit_null());
  VS(f_json_decode("{'x':1}",   true, k_JSON_FB_LOOSE), CREATE_MAP1("x", 1));
  VS(f_json_decode("{y:1,}",    true),       uninit_null());
  VS(f_json_decode("{y:1,}",    true, k_JSON_FB_LOOSE), CREATE_MAP1("y", 1));
  VS(f_json_decode("{,}",       true),       uninit_null());
  VS(f_json_decode("{,}",       true, k_JSON_FB_LOOSE), uninit_null());
  VS(f_json_decode("[1,2,3,]",  true),       uninit_null());
  VS(f_json_decode("[1,2,3,]",  true, k_JSON_FB_LOOSE), CREATE_VECTOR3(1,2,3));
  VS(f_json_decode("[,]",       true),       uninit_null());
  VS(f_json_decode("[,]",       true, k_JSON_FB_LOOSE), uninit_null());
  VS(f_json_decode("[]",        true),       Array::Create());
  VS(f_json_decode("[]",        true, k_JSON_FB_LOOSE), Array::Create());
  VS(f_json_decode("{}",        true),       Array::Create());
  VS(f_json_decode("{}",        true, k_JSON_FB_LOOSE), Array::Create());

  VS(f_json_decode("[{\"a\":\"apple\"},{\"b\":\"banana\"}]", true),
     CREATE_VECTOR2(CREATE_MAP1("a", "apple"), CREATE_MAP1("b", "banana")));

  Variant a = "[{\"a\":[{\"n\":\"1st\"}]},{\"b\":[{\"n\":\"2nd\"}]}]";
  VS(f_json_decode(a, true),
     CREATE_VECTOR2
     (CREATE_MAP1("a", CREATE_VECTOR1(CREATE_MAP1("n", "1st"))),
      CREATE_MAP1("b", CREATE_VECTOR1(CREATE_MAP1("n", "2nd")))));

  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:52,代码来源:test_ext_json.cpp

示例5: VS

bool TestExtFb::test_fb_utf8_strlen() {
  VS(f_fb_utf8_strlen(""), 0);
  VS(f_fb_utf8_strlen("a"), 1);
  VS(f_fb_utf8_strlen("ab"), 2);
  // Valid UTF-8 sequence returns code point count.
  VS(f_fb_utf8_strlen("\ub098\ub294"), 2);
  VS(f_fb_utf8_strlen(INVALID_UTF_8_STRING), 2);
  for (int i = 0; i < 2; i++) {
    // Test utf8ize() handling of invalid UTF-8 sequences and how
    // fb_utf8_strlen() counts them.
    // RuntimeOption::Utf8izeReplace set to non-zero value replaces invalid
    // bytes, including '\0' with a special UTF-8 code point: "\uFFFD".
    // RuntimeOption::Utf8izeReplace set to zero deletes the invalid
    // byte then continues parsing.
    RuntimeOption::Utf8izeReplace = (i == 0);
    {
      Variant s = String("abc\0def", 7, AttachLiteral);
      VS(s.toString().size(), 7);
      VS(f_fb_utf8_strlen(s), 7);

      f_fb_utf8ize(ref(s)); // Modifies s
      int ret = s.toString().size();
      if (RuntimeOption::Utf8izeReplace) {
        VS(ret, 9); // '\0' converted to "\uFFFD"
      } else {
        VS(ret, 6); // '\0' deleted from s
      }
      ret = f_fb_utf8_strlen(s);
      if (RuntimeOption::Utf8izeReplace) {
        VS(ret, 7); // '\0' and "\uFFFD" are both one code point, so no change
      } else {
        VS(ret, 6); // '\0' deleted, so one fewer code point
      }
    }
  }
  return Count(true);
}
开发者ID:Sydney-o9,项目名称:hiphop-php,代码行数:37,代码来源:test_ext_fb.cpp

示例6: VERIFY

bool TestExtFb::test_fb_utf8ize() {
  for (int i = 0; i < 2; i++) {
    RuntimeOption::Utf8izeReplace = (i == 0);
    {
      Variant s = "hon\xE7k";
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "hon\uFFFDk");
      } else {
        VS(s, "honk");
      }
    }
    {
      Variant s = "test\xE0\xB0\xB1\xE0";
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "test\xE0\xB0\xB1\uFFFD");
      } else {
        VS(s, "test\xE0\xB0\xB1");
      }
    }
    {
      Variant s = "test\xE0\xB0\xB1\xE0\xE0";
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "test\xE0\xB0\xB1\uFFFD\uFFFD");
      } else {
        VS(s, "test\xE0\xB0\xB1");
      }
    }
    {
      Variant s = "\xfc";
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "\uFFFD");
      } else {
        VS(s, "");
      }
    }
    {
      Variant s = "\xfc\xfc";
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "\uFFFD\uFFFD");
      } else {
        VS(s, "");
      }
    }
    {
      // We intentionally consider null bytes invalid sequences.
      Variant s = String("abc\0def", 7, AttachLiteral);
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "abc\uFFFD""def");
      } else {
        VS(s, "abcdef");
      }
    }
    {
      // ICU treats this as as two code points.
      // The old implementation treated this as three code points.
      Variant s = INVALID_UTF_8_STRING;
      VERIFY(f_fb_utf8ize(ref(s)));
      if (RuntimeOption::Utf8izeReplace) {
        VS(s, "\uFFFD""\x28");
      } else {
        VS(s, "\x28");
      }
    }
  }
  return Count(true);
}
开发者ID:Sydney-o9,项目名称:hiphop-php,代码行数:72,代码来源:test_ext_fb.cpp

示例7: f_get_declared_classes

bool TestExtClass::test_get_declared_classes() {
  Array classes = f_get_declared_classes();
  VS(f_in_array("test", classes, true), true);
  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_class.cpp

示例8: f_get_declared_interfaces

bool TestExtClass::test_get_declared_interfaces() {
  Array classes = f_get_declared_interfaces();
  VS(f_in_array("itestable", classes, true), true);
  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_class.cpp

示例9: f_header

bool TestExtNetwork::test_headers_list() {
  f_header("Location: http://www.facebook.com");
  VS(f_headers_list(), Array());
  return Count(true);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_network.cpp

示例10: f_get_class_methods

bool TestExtClass::test_get_class_methods() {
  Array methods = f_get_class_methods("TEst");
  VS(methods[0], "foo");
  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_class.cpp

示例11: f_get_class_vars

bool TestExtClass::test_get_class_vars() {
  Array properties = f_get_class_vars("TEst");
  VS(properties, CREATE_MAP1("foo", uninit_null()));
  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_class.cpp

示例12: f_get_class_constants

bool TestExtClass::test_get_class_constants() {
  Array constants = f_get_class_constants("test");
  VS(constants, CREATE_MAP1("const_foo", "f"));
  return Count(true);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:5,代码来源:test_ext_class.cpp

示例13: cmp

/*
 * cmp - chr-substring compare
 *
 * Backrefs need this.	It should preferably be efficient.
 * Note that it does not need to report anything except equal/unequal.
 * Note also that the length is exact, and the comparison should not
 * stop at embedded NULs!
 */
static int						/* 0 for equal, nonzero for unequal */
cmp(const chr *x, const chr *y, /* strings to compare */
	size_t len)					/* exact length of comparison */
{
	return memcmp(VS(x), VS(y), len * sizeof(chr));
}
开发者ID:Aldizh,项目名称:buffer_manager,代码行数:14,代码来源:regc_locale.c

示例14: VS

bool TestExtString::test_addcslashes() {
  VS(f_addcslashes("ABCDEFGH\n", "A..D\n"), "\\A\\B\\C\\DEFGH\\n");
  VS(f_addcslashes(String("\x00\x0D\n", 3, AttachLiteral), null_string),
     "\\000\\r\\n");
  return Count(true);
}
开发者ID:CSRedRat,项目名称:hiphop-php,代码行数:6,代码来源:test_ext_string.cpp


注:本文中的VS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。