File: test_workbook_write_workbook.c

package info (click to toggle)
libxlsxwriter 1.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,888 kB
  • sloc: ansic: 65,861; python: 2,106; makefile: 693; perl: 229; sh: 224; xml: 168; cpp: 73; javascript: 5
file content (30 lines) | stat: -rw-r--r-- 743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Tests for the lib_xlsx_writer library.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 * Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
 *
 */

#include "../ctest.h"
#include "../helper.h"

#include "../../../include/xlsxwriter/workbook.h"

// Test the _write_workbook() function.
CTEST(workbook, write_workbook) {

    char* got;
    char exp[] = "<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">";
    FILE* testfile = lxw_tmpfile(NULL);

    lxw_workbook *workbook = workbook_new(NULL);
    workbook->file = testfile;

    _write_workbook(workbook);

    RUN_XLSX_STREQ(exp, got);

    lxw_workbook_free(workbook);
}