public void spssGetVarCValueLabels() { string varName = "charLabels"; string[] values; string[] labels; SpssSafeWrapper.spssGetVarCValueLabels(handle, varName, out values, out labels); Assert.Equal(2, values.Length); Assert.Equal(2, labels.Length); Assert.Equal("b", values[0].TrimEnd()); Assert.Equal("goodbye", labels[0]); Assert.Equal("h", values[1].TrimEnd()); Assert.Equal("hello", labels[1]); }
/// <summary> /// Initializes the value labels dictionary from the SPSS data file. /// </summary> protected override void LoadFromSpssFile() { if (!Applies) { return; } string[] values; string[] labels; ReturnCode result = SpssException.ThrowOnFailure(SpssSafeWrapper.spssGetVarCValueLabels(FileHandle, Variable.Name, out values, out labels), "spssGetVarCValueLabels", ReturnCode.SPSS_NO_LABELS); if (result == ReturnCode.SPSS_OK) { // ReturnCode.SPSS_NO_LABELS is nothing special -- just no labels to add Debug.Assert(values.Length == labels.Length); for (int i = 0; i < values.Length; i++) { Add(values[i], labels[i]); } } }