summaryrefslogtreecommitdiff
path: root/tests/cpp/include/variables
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cpp/include/variables')
-rw-r--r--tests/cpp/include/variables/019-HashMember-1.h33
-rw-r--r--tests/cpp/include/variables/020-HashMember-2.h41
-rw-r--r--tests/cpp/include/variables/021-HashMember-3.h41
-rw-r--r--tests/cpp/include/variables/022-HashMember-4.h65
4 files changed, 180 insertions, 0 deletions
diff --git a/tests/cpp/include/variables/019-HashMember-1.h b/tests/cpp/include/variables/019-HashMember-1.h
new file mode 100644
index 0000000..28003f0
--- /dev/null
+++ b/tests/cpp/include/variables/019-HashMember-1.h
@@ -0,0 +1,33 @@
+/**
+ *
+ * Test variables
+ * 019-HashMember-1.phpt
+ * Test HashMember
+ *
+ */
+
+
+
+
+/**
+ * Set up namespace
+ */
+namespace TestVariables {
+
+ /**
+ * This function returns complex array
+ */
+ Php::Value test_HashMember_1()
+ {
+ Php::Value r, tmp(Php::Type::Array);
+ r["key1"] = tmp;
+ r["key1"]["key2"] = "val2";
+ r["key1"]["key3"] = "val3";
+ return r;
+ }
+
+/**
+ * End of namespace
+ */
+}
+
diff --git a/tests/cpp/include/variables/020-HashMember-2.h b/tests/cpp/include/variables/020-HashMember-2.h
new file mode 100644
index 0000000..dfa95c2
--- /dev/null
+++ b/tests/cpp/include/variables/020-HashMember-2.h
@@ -0,0 +1,41 @@
+/**
+ *
+ * Test variables
+ * 019-HashMember-2.phpt
+ * Test HashMember
+ *
+ */
+
+
+
+
+/**
+ * Set up namespace
+ */
+namespace TestVariables {
+
+ /**
+ * This function returns complex array
+ */
+ Php::Value test_HashMember_2()
+ {
+ Php::Value r, empty_array(Php::Type::Array);
+ r["k1"]["k3"] = "v1";
+ r["k1"]["k2"]["k4"] = "v2";
+ r["k5"][1] = "v3";
+ r[2]["k6"][1] = "v4";
+ r[3][4][1] = "v5";
+ r[3][4][2][5][7][11] = "v5";
+ r[3][4][2][5][7]["k"] = "v5";
+ r["c"][0] = "nested value";
+ r["c"][1] = nullptr;
+ r["c"][2] = empty_array;
+ r["c"][3] = "example";
+ return r;
+ }
+
+/**
+ * End of namespace
+ */
+}
+
diff --git a/tests/cpp/include/variables/021-HashMember-3.h b/tests/cpp/include/variables/021-HashMember-3.h
new file mode 100644
index 0000000..f7c0914
--- /dev/null
+++ b/tests/cpp/include/variables/021-HashMember-3.h
@@ -0,0 +1,41 @@
+/**
+ *
+ * Test variables
+ * 019-HashMember-3.phpt
+ * Test HashMember
+ *
+ */
+
+
+
+
+/**
+ * Set up namespace
+ */
+namespace TestVariables {
+
+ /**
+ * This function returns complex array
+ */
+ Php::Value test_HashMember_3()
+ {
+
+ Php::Value r, tmp(Php::Type::Array);
+ //Php::Value tmp;
+
+ tmp.set("key2", "val1-2");
+ r.set("key1", tmp);
+ r.get("key1").set("key3", "val1-3");
+
+ // expect to receive the same as when recording:
+ //r["key1"]["key2"] = "val1-2";
+ //r["key1"]["key3"] = "val1-3";
+
+ return r;
+ }
+
+/**
+ * End of namespace
+ */
+}
+
diff --git a/tests/cpp/include/variables/022-HashMember-4.h b/tests/cpp/include/variables/022-HashMember-4.h
new file mode 100644
index 0000000..e51eb3a
--- /dev/null
+++ b/tests/cpp/include/variables/022-HashMember-4.h
@@ -0,0 +1,65 @@
+/**
+ *
+ * Test variables
+ * 019-HashMember-4.phpt
+ * Test HashMember
+ *
+ */
+
+
+
+
+/**
+ * Set up namespace
+ */
+namespace TestVariables {
+
+ /**
+ * This function returns complex array
+ */
+ Php::Value test_HashMember_4()
+ {
+
+
+ Php::Value r1;
+ Php::Value tmp1,tmp2;
+ tmp2.set("key3", "val");
+ tmp1.set("key2", tmp2);
+ r1.set("key1", tmp1);
+ // this should be equivalent to:
+ // r1["key1"]["key2"]["key3"] = "val";
+
+ Php::Value r2;
+ r2.set("str1", "example");
+ r2.set("str2", r2.get("str1"));
+ // this should be equivalent to:
+ // r2["str1"] = "example";
+ // r2["str2"] = r2["str1"];
+ // i.e.
+ // r2["str1"] = "example";
+ // r2["str2"] = "example";
+
+ Php::Value r3;
+ Php::Value tmp;
+ tmp.set("str2", "val1-2");
+ tmp.set("str3", "val1-3");
+ r3.set("str1", tmp);
+ // this should be equivalent to:
+ // r3["str1"]["str2"] = "val1-2";
+ // r3["str1"]["str3"] = "val1-3";
+
+
+ Php::Value r;
+ r[0] = r1;
+ r[1] = r2;
+ r[2] = r3;
+
+
+ return r;
+ }
+
+/**
+ * End of namespace
+ */
+}
+